Move from apache2-mpm-prefork to apache2-mpm-worker, and use php5-cgi on Debian Squeeze for more performance

Valic —  February 2, 2012 — Leave a comment

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:

a2enmod cgid

Step4. Activate mod_actions: (That is the module that provides for executing CGI scripts based on media type or request method.)

a2enmod actions

Step5. Add the following to mod_actions config:

vim /etc/apache2/mods-enabled/actions.conf

and paste the following:

Action application/x-httpd-php /cgi-bin/php5

Step6. Start apache2:

/etc/init.d/apache2 start

Now the amount of memory used on your machine is a lot less.
PHP now runs as its own process for the requests.



Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply