And more on PHP
By jmccabe on Jun 10, 2006
In my article about PHP and Web Server I drew upon my experience with PHP 4 and NSAPI. In working with PHP 5 the functions that get initialized in the magnus.conf and executed within the obj.conf need to have their names change from php4_FOO to php5_FOO:
And in other news, people have been reporting problems using PHP as an NSAPI with Web Server 7 due to a missing header file, nsapi.h. This is happening because PHP is looking for this header file in [server_root]/plugins/include/ but in Web Server 7 that directory has been moved to [server_root]/include/. While the obvious correct solution is for the PHP build environment to be updated to look for the required file in the new location, a workaround is to simply symlink the directory to the old location:
ln -s ../include .
It's been several years since I tried using the NSAPI PHP in production, and I figured there's a good chance that the stability problems I saw previously have been dealt with (I've been using it in FastCGI mode for the last two years).
The NSAPI module has been running for five hours. It's supporting one install of phpBB with a fairly active community (~1300 users, ~200 new messages a day, and ~50 page views per minute), four installs of Gallery 2 (each with 1,000 images or more), and one infrequently accessed install of SquirrelMail. PHP is compiled with:
./configure --with-nsapi=/export/WS7/ --enable-track-vars --enable-force-cgi-redirect --with-gettext --with-zlib --with-gd --with-mysql
So far I count 56 webservd daemon restarts in these five hours. That's one crash/restart every five minutes that I didn't see when PHP was being run as a FastCGI (where PHP may be crashing and restarting every few minutes but is not affecting the stability of my server). Looks like I'm rolling back to FastCGI again.
For reference here's the relevant parts of my magnus.conf, obj.conf, and mime.types:
#PHP type=magnus-internal/x-httpd-php exts=php,php3,php4
Init fn="load-modules" shlib="/export/WS7/third-party/php/libphp.so" funcs="php5_init,php5_close,php5_execute,php5_auth_trans" Init fn="php5_init" errorString="PHP Totally Blowed Up!"
Service fn="php5_execute" type="magnus-internal/x-httpd-php" bucket="php-bucket"