Here is how to change from apache2-mpm-prefork to apache2-mpm-worker, , when having used mpm-prefork before, and php5, on Debian Squeeze.
Step1. Stop Apache2:
# /etc/init.d/apache2 stop
Step2. Install apache2-mpm-worker:
That will remove some packages, like apache2-mpm-prefork and libapache-mod-php5, and install apache2-mpm-worker, and php5-cgi instead.
# apt-get install apache2-mpm-worker
Step3. Set Apache2 to use php5-cgi:
Activate CGI using the command:
Step4. Activate mod_actions: (That is the module that provides for executing CGI scripts based on media type or request method.)
Step5. Add the following to mod_actions config:
and paste the following:
Action application/x-httpd-php /cgi-bin/php5
Step6. Start apache2:
Now the amount of memory used on your machine is a lot less.
PHP now runs as its own process for the requests.