Mysql Database Connectivity Issue

Discussion in 'PHP' started by MaxX, Jan 2, 2007.

  1. MaxX

    MaxX Member


    I have installed LiteSpeed on my server. Currently I have apache/cpanel and I followed all the wiki's (I selected to NOT import the apache config during installation) and installed LiteSpeed, loaded the apache config in the control panel and also compiled lsphp according to the other wiki.

    MySQL does not connect for some reason.

    I have set a 1000 port offset and both my portal and forums do not connect to database.

    For eg. (Thats the error it gives when it cannot connect to database) although regular apache works fine -

    I configured PHP with the SAME options.. see phpinfo -

    and of Apache -

    I know thats its some PHP/MySQL issue, but I cant fathom what it is, as everything is followed to the dot and I retried multiple times..
  2. mistwang

    mistwang LiteSpeed Staff

    You need to fix the default MySQL Socket address, in Apache it is /var/lib/mysql/mysql.sock, in LSWS it is /var/tmp/mysql.sock.

    lsphp could not find a valid php.ini, maybe due to permission problem. Anyway, you can change the commnd of lsphp external app to give the path of php.ini with command line option "lsphp -c <path_to_php.ini>".
  3. MaxX

    MaxX Member

    I changed the MySQL Socket Address in php.ini as such-

    mysql.default_socket = /var/tmp/mysql.sock

    I even tried the -c statement above but it does not seem to help..

    I also reinstalled LiteSpeed into /usr/local/lsws.. but the issue remains..

    I use CentOS 4 and MySQL 4.1
  4. mistwang

    mistwang LiteSpeed Staff

    which php.ini do you use?
    You should use /usr/local/lib/php.ini as lsws/conf/php.ini may not be available when php started in suexec mode as lsws/conf has permission 0700.
  5. MaxX

    MaxX Member

    The php suexec is set as N/A.

    Anyway in external apps/command I modified the command to $SERVER_ROOT/fcgi-bin/lsphp -c /usr/local/lib/php.ini

    Now PHP itself has stopped working!

    I get a 503 Service unavailable
    Last edited: Jan 3, 2007
  6. MaxX

    MaxX Member

    Also if I just run lsphp from shell prompt -

    ./lsphp -c /usr/local/lsws/conf/php.ini -i | less

    Then it loads the configuration properly (eaccelerator is present and mysql values are correct from config)

    Why cant the server do the same?
    Last edited: Jan 3, 2007
  7. MaxX

    MaxX Member

    Actually I just noted that from the shell prompt if I JUST run lsphp also it works properly..

    root@server [/usr/local/lsws/fcgi-bin]# ./lsphp -i | less

    (loads correct config)


    I reinstalled PHP.. but the thing refuses to work (load the php.ini). I even removed all relative paths (of eaccelerator from php.ini)

    From the shell prompt if I give /usr/local/lsws/fcgi-bin/lsphp -i |less I can see that it loads the php.ini perfectly, but the server cant do that!
    Last edited: Jan 3, 2007
  8. MaxX

    MaxX Member

    So this is the stage Im in now-

    I am using the php from /usr/local/lib/php2.ini (I copied the litespeed php to here).

    It loads it fine, all values show up, even eaccelerator.

    But MySQL connection still does not work.

    Any advise?
  9. MaxX

    MaxX Member

    I fixed it myself after pouring through tons of manuals... MySQL 4.1/5 uses new authentication methods.. your wiki's are horribly outdated! (and it seems that users cant update it..)
  10. mistwang

    mistwang LiteSpeed Staff

    Glad to know that you fixed it.

    It is always recommended to build php with the mysql client library installed on your system.

    You should be able to update the wiki with your forum login, as I knew.
  11. tdunford

    tdunford Member

    Sorry for replying to an old thread, but I have the exact same problem with the mysql connection error and have tried everything and researched for days and have not been able to fix my problem. MaxX, if you remember, can you please describe how you fixed the problem? Thank you.

Share This Page