Wordpress

#1
Hi guys,

I'm currently trying to get Wordpress working with my Litespeed install and I'm having a couple of issues. I've noticed that other people on this forum have had similar problems, but I'm not sure if mine is the same (I've tried a few things that have been suggested on the wiki and on the forum to no avail).

So here are the details. I'm running Gentoo, with both php4 and php5 installed. I have installed Litespeed 3.0, and have MySQL 5 installed too.

I migrated a copy of my Wordpress install from an existing server, including the contents of the database, and tried firing it up in a browser. The Wordpress error I get is:
Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down.

* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct hostname?
* Are you sure that the database server is running?

If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
Now, if I use the MySQL command line I'm able to login using the credentials that I've specified in the configuration file, and it works fine - which leads me to think that it's not a permissions issue (at least for the login part). So it looks like Litespeed is struggling to speak to MySQL using PHP.

My virtual host is set to use LSAPI: [VHost Level]: $VH_NAME_lsphp
I have tried using [Server Level]: phpLsapi but I have a different error.

Could someone give me an idea as to what the problem might be? I read on the wiki that I have to apparently compile LSAPI support into my php installation(s), if that's the case, can someone give me a pointer as to how to do this with Gentoo's portage? I can't seem to find any information on it on the web (it's mentioned in one post, but there aren't really clear instructions in there on how it should be done).

Any help would be greatly appreciated - at the mo this is the only showstopper as far as my Litespeed insatllation is concerned.

Thanks for your time.
Kind regards
OJ.
 

mistwang

LiteSpeed Staff
#2
You need to check the Mysql socket location used by PHP, you can look that information up in a phpinfo() page. The mysql socket address should match what is used by MySQL. You can fix the mysql socket address in php.ini referenced in phpinfo() page.
 
#3
Thanks for your response.

MySQL is running on the default port (3306), and the phpinfo() pages tells me this:
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.1.22
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I../mysql/include
MYSQL_LIBS -L../mysql/lib -lmysqlclient
When I run 'ls' on /tmp there is no evidence of mysql.sock, so I went searching for it. I found it in /var/run/mysqld/ and so changed the value of mysql.default_socket in the php.ini file to:

mysql.default_socket = /var/run/mysqld/mysql.sock

Unfortunately, this made no difference. I tried changing the default port, but again this made no difference. After I change mysql.default_socket the change doesn't get reflected in the phpinfo() page, so I'm not sure if it's picking it up properly.

So to recap: I ran phpinfo(), got the path to the php.ini file, opened that up, changed the mysql.default_socket to point to the /var/run/mysqld/mysql.sock file, restarted lsws, ran phpinfo() again but the value for the mysql socket hadn't changed, and when I tried to access my php script which connects to MySQL I get the same error as before.

Am I doing something wrong?

Thanks for your help.
Regards
OJ.
 
#4
Hello again,

My bad, I don't think I was very clear. As I said, I have set the value of mysql.default_socket, and the phpinfo() now shows the following:

Code:
MySQL Support	enabled
Active Persistent Links 	0
Active Links 	0
Client API version 	4.1.22
MYSQL_MODULE_TYPE 	external
MYSQL_SOCKET 	/tmp/mysql.sock
MYSQL_INCLUDE 	-I../mysql/include
MYSQL_LIBS 	-L../mysql/lib -lmysqlclient

Directive	Local Value	Master Value
mysql.allow_persistent	Off	Off
mysql.connect_timeout	-1	-1
mysql.default_host	no value	no value
mysql.default_password	no value	no value
mysql.default_port	no value	no value
mysql.default_socket	/var/run/mysqld/mysql.sock	/var/run/mysqld/mysql.sock
mysql.default_user	no value	no value
mysql.max_links	Unlimited	Unlimited
mysql.max_persistent	Unlimited	Unlimited
mysql.trace_mode	Off	Off
So the value IS being set, but the main MYSQL setting at the top still has the wrong path. Is this why it's still failing to connect?

Cheers
OJ
 

mistwang

LiteSpeed Staff
#6
Looks like you have to build your own lsphp binary using the mysql client library on your server.
Please check out the toturial on building lsphp binary in our Wiki.
 
#7
Hello guys,

Thanks for the pointers. I've rebuilt php5, and now have it all working.

I'd just like to point out a small flaw with the tutorial on the wiki. The problem I was attempting to solve was to get lsapi working with mysql. The wiki page explains how to rebuild from source and include the required code from litespeed, but there is an error when it comes to configuration. It currently says:
Code:
./configure '--prefix=/php5' '--with-litespeed' '--with-config-file-path=../conf'
.. but this doesn't compile support for MySQL (v5), so it should be changed to:
Code:
./configure '--prefix=/php5' '--with-litespeed' '--with-config-file-path=../conf' '--with-mysql'
Also, since the default location for the php.ini file is in lsws/php, why not change the config file path to '../php' so that no copying of files is required?

The command line could then look like this:
Code:
./configure '--prefix=/php5' '--with-litespeed' '--with-config-file-path=../php' '--with-mysql'
and you wouldn't have to do anything else other than copy the binary over to the fcgi-bin folder!

Other than that, it's bang on. Thanks a lot!
OJ
 
Top