Mysql – Viability of Apache (MPM Worker), FastCGI PHP 4/5.2/5.3, and MySQL 5

apache-2.2fastcgimpm-workerMySQLPHP

My server will be hosting numerous PHP web applications ranging from Joomla, Drupal, and some legacy (read: PHP4) and other custom-built code inherited from clients. This will be a development machine used by a dozen or so web developers and issues like fluctuating loads or particularly high load expectations are not important.

Now, my question: are there any concerns I should know about when using Apache w/ MPM Worker, PHP 4/PHP 5.2/PHP 5.3 (all via FastCGI), and MySQL 5 (with a query cache of 64MB)?

I have not tested the various applications extensively and I have only recently learned how to install PHP and utilize it via FastCGI (rather than mod_php, which in this case seemed impossible (considering the multiple versions of PHP and the desire to use MPM Worker over MPM Prefork)).

I have come to understand that there could be concerns regarding XCache and APC, namely non-thread-safety issues where data becomes corrupted and the capability to use MPM Worker becomes null and void. Is this a valid concern?

I have been using my personal testing server (running Ubuntu Server Edition 10.04 in VirtualBox) which has 2GB of RAM available to it.

Here is the configuration used (the actual server will likely use a configuration more tailored to suit it's purposes):

Apache:

Server version: Apache/2.2.14 (Ubuntu)
Server built:   Apr 13 2010 20:22:19
Server's Module Magic Number: 20051115:23
Server loaded:  APR 1.3.8, APR-Util 1.3.9
Compiled using: APR 1.3.8, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Worker
    threaded:     yes (fixed thread count)
        forked:     yes (variable process count)

Worker:

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          400
    MaxRequestsPerChild 2000
</IfModule>

PHP ./configure (PHP 4.4.9, PHP 5.2.13, PHP 5.3.2):

--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-sqlite-utf8 \
--enable-wddx \
--enable-zip \
--enable-fastcgi \
--with-zlib \
--with-gettext \

Apache php-fastcgi-setup.conf

FastCgiServer /var/www/cgi-bin/php-cgi-5.3.2
FastCgiServer /var/www/cgi-bin/php-cgi-5.2.13
FastCgiServer /var/www/cgi-bin/php-cgi-4.4.9

ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/

Best Answer

The only thing you should ask yourself is: Are you really expecting so much traffic on your site to warrant such a complicated and risky setup (as opposed to "regular" prefork + php as a module).

I've been running a couple of php heavy sites peaking at 10m+ hits/day without having the need to switch to threaded model. PHP per se is a mess, making it jump through hoops is asking for it.