PHP FCGI Module and Mysql 4.x+

#1
When i trie to load my PHPWebsite scripts i get an error:
"Unable to load database indicated by configuration file."
It works fine (but slow) under Apache.

What do i have to do to make PHP FastCGI access the 4.1 MySQL DB?

I use MySQL 4.1a on RH9 (all updates applied) / Apache 1.3.27 / PHP 4.3.1 system.
 

mistwang

LiteSpeed Staff
#2
Thank you for trying our web server.

By default, PHP looks for MySQL's socket at /tmp/mysql.sock, it is configurable in php.ini. RedHat usually place MySQL's socket somewhere else, see your /etc/my.cnf. Both configuration should match.

Your problem may caused by the missing php.ini if you are using the prebuilt PHP binary coming with our installation package, it is configured to search php.ini under ../conf/ instead of /usr/local/lib/. One quick solution is to copy /usr/local/lib/php.ini to [lsws_home]/conf, restart server or just kill all PHP processes.

Only FastCGI interface is enabled in the prebuilt PHP binary, so if you need any features that are missing, you need to build PHP from source, for detail, please read respective HOWTO. Please stay with 4.3.1 if you can, as newer versions are bugy in fast CGI interface.

If your site is database and/or PHP script intensive, you may not observe big performance boost by switching to our server unless it is under extreme load, Apache could become really slow. If you want you can run both web servers on different ports in parallel and "ab" them. You also can try PHP Accelerator see if it help.

We'd like to know how is our web server against Apache, please post your impression if possible.

Best regards,
Mistwang
 
#3
Does PHP Accelerator work with 4.3.1? The latest binary version i found was made for 4.3.0. Any idea? (And do you know where to place the zend_extension tag in php.ini? Tried but got no working results.)
 

mistwang

LiteSpeed Staff
#4
Yes, it works.
I put zend_extension tag just below "dynamic extensions", do a search.
Remember to kill all PHP processes after configuration changes.
Load /phpinfo.php in your browser, PHP accelerator should appear in the copyright section.

BTW: I assume your web site works now, isn't it? :)

Best regards,
Mistwang
 
#5
Not really. PHPA has a shm prob... I try something else. Yo, i have Turck MMCache up and running. Its pretty fast (Even faster than Zend).
 

mistwang

LiteSpeed Staff
#6
Cool!

Last time I have difficulties to compile Turck MMCache with PHP. I will try it later.

So your new PHP binary can connect to MySQL too, I assume.

Best regards,
Gang
 
#7
Yes. It needed a ./configure --with-mysql=/usr and compiled fine using MySql 4.0.14 (table cache switched on) using the 3.x compatibility libs.

I compiled Turck as written on their page:

export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make

Then i copied the .so manually to /usr/lib/php4 and added this config lines after all other modules:

extension="mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"

The cache dir has to be set up manually:

mkdir /tmp/mmcache
chmod 0777 /tmp/mmcache
 

mistwang

LiteSpeed Staff
#8
Cool!

I compiled MMCache successfully too this time. It is nice to have another option for PHP acceleration.

Thank you for your information.
If you have any comments, suggestions or criticism, please let us know.

Best regards,
Mistwang
 
#9
Compared your free Edition now with a Tux/Apache 1.3.27/PHP 4.3.1/MySQL 4.0.14/Turck MMCache Combo and they seem both fast, yours a tick faster with PHPWebsite 9.03.1. Both used the same DB and accelerating libs.

You should compile your PHP fcgi executable with mysql shared since PHP seems to take no other shared mods if there is not at least one mod compiled shared. I tried 4.3.3 and it worked fine this way.

PHP Options (change paths):

./configure --prefix=/usr/local/thunder \
--with-config-file-path=/usr/local/thunder/etc \
--enable-shared \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect \
--with-mysql=shared,/usr/local/thunder \
--with-zlib

From PHP.ini:

output_buffering = On
zlib.output_compression = 16KB
...
extension=mysql.so
extension=mmcache.so
mmcache.shm_size="16"
mmcache.cache_dir="/usr/local/thunder/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"

MySQL Speedup 4.x:
query_cache_size = 16000000

PHPWebsite performs nicely now on my good old HP E45 (PII 266/192MB RAM). Before it was a nightmare. ;-)

You need some beta testers for the commercial litespeed version? I would!
(The config interface is really a lot nicer than Apache/Webmin.
And there is no config interface for lighttpd wich i would try next... *g*)

BTW: Somewhere should be a real fat headline "Chmod your static files to 644 in oder to see them" for n00bs like me. :)
 

mistwang

LiteSpeed Staff
#10
Thank you for the update and suggestion. :)

PHP 4.3.3 has problem when PATH_INFO is popluated. The PHP_SELF is set to PATH_INFO instead of SCRIPT_NAME. We submitted bug report but it is not resolved completely since 4.3.2. Also 4.3.2 and above should be configured with --disable-path-info-check. So we still recommend 4.3.1.

User should build PHP binary from source if they need extra features. It is hard to build one that will make everyone happy. :) Your suggestion can be added in the documentation though.

I have no problem to use the acceleration modules with the prebuilt PHP.

I just took a look at lighttpd, and I believe it will show similiar performance as our product. But our server does not take advantage of any fancy API like sendfile() or SIGIO yet.

Sorry for not clearly stating the permission about the static file. It will be added in the trouble shooting section in the document. It is one of our secuirty feature to prevent accidentally serve content that is not intended to be served by web server.

We do need beta testers and appreciate any help. I will send your the beta release to your registered email, is that OK? Or you can send email to info@litespeedtech.com. Another beta user Paul from pizza.org help us a lot. :)
If you happen to have an account on freshmeat.net, you can subscribe to our project too.

Best regards,
Mistwang
 
Top