Bug in config.php and solution

USB-Linux
2010-08-30
2013-05-30
  • USB-Linux
    USB-Linux
    2010-08-30

    Hello,

    I installed today phpgedview and I had problems with the pdo_mysql. I found a bug and the solution to this one.
    This is the problem:
    in the config.php in line 38 is normaly:  "$DBHOST='localhost'; //- Host where MySQL database is kept" .
    But this leads on some Servers the Error:  "ERROR 2: PDO::__construct()", because the pdo want to have 127.0.0.1 to work.

    Solution:
    After changing the line to  "$DBHOST='127.0.0.1'; //- Host where MySQL database is kept"  the System worked.

    Yours
    usb-linux

     
  • Stephen Arnold
    Stephen Arnold
    2010-08-30

    Not necessarily a 'bug' but rather that your hosts file has not been configured on your server with the phrase:
    127.0.0.1 localhost

    Some prefer this setup as it has been viewed that the use of 'localhost' can be more easily hacked within the HOSTS file and diverted to an external IP, say
    80.80.80.80 localhost

    However, the preponderance of configs use the host file for the equivalency of 127.0.0.1 = localhost

    If you choose not to configure it as such, for whatever the reasons (can't, won't), this is easy remedied as you suggested in altering your database host information, as you did. Still, IMHO, I would not necessarily refer to it as a bug.
    -Stephen[/color/

     
  • Greg Roach
    Greg Roach
    2010-08-30

    Out of interest, if your MySQL server is configured to accept direct connections (via a socket), rather than over a network port (127.0.0.1:3306), then you can connect directly to the database by specifying a host of just a dot/period "."

    This bypasses the network protocol, and can give slightly better performance.

    YMMV