When your webserver is receiving a lot of traffic and began slow your website down, you might be consider to switch mod_php with php-fpm.
- First get mod_fastcgi from rpmforge
2 | listen = /var/run/php5-fpm.sock |
3 | ;listen = 127.0.0.1:9000 |
15 | pm.min_spare_servers = 5 |
16 | pm.max_spare_servers = 20 |
17 | pm.process_idle_timeout = 10s |
- Rename mod.php to mod.php.bak
that will disabled mod_php.
- Configure mod_fastcgi in /etc/httpd/conf.d/fastcgi.conf. add these lines at the end of file.
4 | FastCgiConfig -idle-timeout 20 -maxClassProcesses 1 |
6 | DirectoryIndex index.php |
7 | AddHandler php-fcgi .php |
8 | Action php-fcgi /php-fcgi |
9 | Alias /php-fcgi /cgi-bin-php.fcgi |
10 | FastCgiExternalServer /cgi-bin-php.fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization |
- Start php-fpm and restart httpd service.
that’s it.