To run separate apache and php processes on centos (at least) without
having to compile and install separate versions for every instance
this should work:
Install apache and php with yum.
This will give you (for the first instance):
/etc/httpd/*, /etc/sysconfig/httpd, /etc/init.d/httpd, /etc/php.ini
and /etc/php.d/*.
Copy all this stuff to:
/etc/httpd2/*, /etc/sysconfig/httpd2, /etc/init.d/httpd2, /etc/php2.ini
and /etc/php2.d/*.
Then:
Edit the apache config files in /etc/httpd2/* to reflect the new
ports you want to have this apache listen on (don't forget ssl.conf
under conf.d) and any other differing settings, like log file
destinations and virtualhosts.
Edit the php2.ini for any specific settings you want the other php
instance to have.
To have a completely separate php in this new apache instance with its own
modules included, edit /etc/sysconfig/httpd2 and add the following:
PHPRC=/etc/php2.ini
export PHPRC
PHP_INI_SCAN_DIR=/etc/php2.d
export PHP_INI_SCAN_DIR
This will set the environment variables for the second apache/php
instance before it is started.
Then edit /etc/init.d/httpd2 and change all references to httpd
(like lockfile, pidfile and sysconfig) to httpd2. Don't touch the
executable name, though :)
And change this:
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
to this:
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd -f /etc/httpd2/conf/httpd.conf $OPTIONS
.. so this apache can find its own configuration file.
Then, if necessary 'chkconfig --add /etc/init.d/httpd2' to have it
in startup and you should have two apache instances with two separate
php modules with their own dedicated settings.