Table of Contents: --------------------------------------------------------------------- * Using php4 with threaded webservers (eg. apache2-mpm-worker, caudium) * Problems starting apache with php4 * Session storage * Other caveats * php4-cgi and apache/apache2 * Restarting your web server after installing modules * Configuration layout * Further documentation, errata, etc Using php4 with threaded webservers (eg. apache2-mpm-worker, caudium) --------------------------------------------------------------------- After much back-and-forth with upstream (and even building our packages thread-safe for a while), we're currently admitting defeat on that front, and are NOT building any thread-safe versions of PHP for any webservers. Our recommendation is that, if you need to use a threaded webserver, you should use php4-cgi in either 'normal' CGI mode, or in FastCGI mode. Adam Conrad Sun, 06 Feb 2005 08:24:56 -0700 Problems starting apache with php4 ---------------------------------- At the time of writing, there are no *known* incompatibilities between any of the php4 modules we ship. However, there have been many bug reports in the past due to dynamically-loaded extensions, and it's possible there are still bugs in the released packages. If Apache fails to start after you install php4, check your list of enabled extensions at the bottom of /etc/php4/apache/php.ini, and try commenting out or reordering the extensions until you find a combination that works. For example, in the past the mhash extension was incompatible with some other common extensions. To work around this, you could list the mhash extension first in php.ini. If you find an extension-related bug in the Debian packages, and you are willing to help debug the problem, please send us a bug report that lists all enabled PHP4 extensions (extension=), in the order in which they appear in php.ini, as well as all enabled Apache modules (LoadModule), with version numbers where possible. Steve Langasek Fri, 26 Apr 2002 13:39:00 -0500 Session storage --------------- Session files are stored in /var/lib/php4. For security purposes, this directory is unreadable by non-root users. This means that php4 running from apache, for example, will not be able to clean up stale session files. Instead, we have a cron job run every 30 mins that cleans up stale session files; /etc/cron.d/php4. You may need to modify how often this runs, if you've modified session.gc_maxlifetime in your php.ini; otherwise, it may be too lax or overly aggressive in cleaning out stale session files. Andres Salomon Fri, 03 Sep 2004 03:12:54 -0400 Other caveats ------------- * extension_dir and include_path should be commented out, if you don't need special settings for them so php will look in compiled-in paths. If you set them, you should also add appropriate php install directories there. php4-cgi and apache/apache2 --------------------------- In 99% of cases, what you probably want isn't php4-cgi at all, but rather the libapache-mod-php4 or libapache2-mod-php4 package, which will configure themselves on installation and Just Work(tm). If, however, you have a need to use the CGI version of php4 with apache/apache2, the following should help get you going, though there are dozens of different ways to do this. Please note that this process will never be made automatic, as php4-cgi is meant to be a webserver-agnostic package that can be used with any httpd, and we don't want it to conflict with the httpd-specific packages such as libapache-mod-php4. If both were installed side-by-side and both were automatically enabled, the results would be a bit confusing, obviously. If you want to use php4-cgi in apache 1) activate mod_action (apache-modconf apache enable mod_actions) 2) Add the following to a config snippet in /etc/apache/conf.d Action application/x-httpd-php /cgi-bin/php4 To use php4-cgi with apache2 1) activate CGI (it's on by default in default debian setups) a) If using the prefork MPM, use 'a2enmod cgi' b) If using a threaded MPM, use 'a2enmod cgid' 2) activate mod_actions (a2enmod actions) 3) Add the following to a config snippet in /etc/apache2/conf.d Action application/x-httpd-php /cgi-bin/php4 Adam Conrad Sat, 04 Sep 2004 23:04:26 -0600 Restarting your web server after installing modules --------------------------------------------------------------------- Many of the php modules (php4-mysql, for example) require that you restart your webserver after installation. This currently isn't done automatically, so changes won't take affect until you run /etc/init.d/apache2 reload or your webserver's equivalent (some cases may need to use "restart" instead of "reload" too) sean finney Sat, 09 Dec 2006 12:42:21 +0100 Configuration Layout --------------------------------------------------------------------- Each of the 4 SAPI's (apache/apache2/cgi/cli) have a different central configuration file /etc/php4/$SAPI/php.ini. Additionally, each SAPI is configured with the compile-time option --with-config-file-scan-dir=/etc/php4/$SAPI/conf.d which for all SAPI's is actually a symlink pointing to a central directory /etc/php4/conf.d. Any file found in this directory ending in .ini will be treated as a configuration file by the php SAPI. The rationale with this method is that each SAPI can thus be identically configured with a minimal amount of conffile handling, but at the same time if you want to have SAPI-specific configuration, you can just remove the symlink. sean finney Thu, 19 Oct 2006 23:33:05 +0200 Further documentation, errata, etc --------------------------------------------------------------------- Errata and other general information about PHP in Debian can be found in the debian wiki at: http://wiki.debian.org/PHP If after reading the documentation in this file you still have unanswered questions, that's a good next place to go. sean finney Thu, 19 Oct 2006 22:57:52 +0200