Mysql Database Connectivity Issue

#1
Hi,

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. http://www.funonthenet.in:1080/forums/ (Thats the error it gives when it cannot connect to database) although regular apache works fine - http://www.funonthenet.in/forums/

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

http://www.funonthenet.in:1080/phpinfo.php

and of Apache - http://www.funonthenet.in/phpinfo.php

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..
 

mistwang

LiteSpeed Staff
#2
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
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>".
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
 

mistwang

LiteSpeed Staff
#4
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
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.
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:
#6
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:
#7
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)

[update]

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:
#9
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..)
 

mistwang

LiteSpeed Staff
#10
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
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.
 
Top