Using php5 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 php5-cgi in either
   'normal' CGI mode, or in FastCGI mode.

Adam Conrad <adconrad@0c3.net>  Sun, 06 Feb 2005 08:24:56 -0700


Problems starting apache with php5
----------------------------------

   At the time of writing, there are no *known* incompatibilities
   between any of the php5 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 php5, check your list of
   enabled extensions at the bottom of /etc/php5/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 PHP5 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 <vorlon@debian.org>  Fri, 26 Apr 2002 13:39:00 -0500


Session storage
---------------

    Session files are stored in /var/lib/php5.  For security purposes, this
    directory is unreadable by non-root users.  This means that php5 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/php5.  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 <dilinger@debian.org>  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.

php5-cgi and apache/apache2
---------------------------

In 99% of cases, what you probably want isn't php5-cgi at all, but rather
the libapache-mod-php5 or libapache2-mod-php5 package, which will configure
themselves on installation and Just Work(tm).  If, however, you have a need
to use the CGI version of php5 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 php5-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-php5.  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 php5-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
      <IfModule mod_actions.c>
        Action application/x-httpd-php /cgi-bin/php5
      </IfModule>

To use php5-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
      <IfModule mod_actions.c>
        Action application/x-httpd-php /cgi-bin/php5
      </IfModule>

Adam Conrad <adconrad@0c3.net>  Sat, 04 Sep 2004 23:04:26 -0600
