Can't connect to mysql

palb

Well-Known Member
#1
If the info.php states what MySQL client API version is, does it mean PHP is correctly configured for Litespeed and MySQL?

I can't connect to mysql, so I figured if above is true then it must be something within Litespeed settings, right? Any clues?
 

mistwang

LiteSpeed Staff
#2
If the info.php states what MySQL client API version is, does it mean PHP is correctly configured for Litespeed and MySQL?
Yes.

I can't connect to mysql, so I figured if above is true then it must be something within Litespeed settings, right? Any clues?
No, LiteSpeed will not affect the PHP, it is completely a PHP issue.
Please double check the MySQL socket configuration in the info page.
Also, you can check lsws/logs/error.log and stderr.log see if PHP dump any error message.
 

brrr

Well-Known Member
#3
Solution to MySQL and LiteSpeed connect prob on CentOS

I had the same problem: MySQL 5 and LiteSpeed do not work together out-of-the-box, at least on a default, vanilla CentOS 5 install.

The default LiteSpeed (compiled) PHP config is telling PHP that MySQL's UNIX socket is at:
/tmp/mysql.sock

When in fact it should be (the default on my CentOS 5 server):
/var/lib/mysql/mysql.sock

To change it: edit: /opt/lsws/php/php.ini

and under the [MySQL] section, change it as follows:

Code:
; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =/var/lib/mysql/mysql.sock
It worked for me.

It was a bit confusing though to track this down - there are at least *3* php.ini files floating around under the /opt/lsws directory.

Figuring out which one was active was only revealed (of course) by looking at the phpinfo output.
 
Top