RootConsole.net

advices, tips, blog

  • Home

Apache2 with php-cgi

Posted by Admin on November 14, 2013
Posted in: Programming, Servers. Tagged: apache2, cgi, php.

Many web production systems  because of compatibility issues base on Apache2 backend and Nginx frontend servers. This solution gives a good known and configurable environment for all out of the box web products. The simplest method is installing an apache2-mpm-prefork with mod-php5 module. Unfortunately this solution has very poor performance. How to increase the performance of that system? Use CGI version of PHP and fcgi module instead of mod-php5. What you have to do on Debian?

Install apache apache2-mpm-worker and libapache2-mod-fcgid:

# apt-get install apache2-mpm-worker libapache2-mod-fcgid

Install php5-cgi:

# apt-get install php5-cgi

Then you can configure php5-cgi. Remember to use configuration file for cgi version!

# vim /etc/php5/cgi/php.ini

The last thing to change is a virtual host configuration. Add the following lines to the virtual host configuration file.

AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options +ExecCGI

Restart Apache and test your configuration.

Posts navigation

← How to limit a rate of incoming messages from a specified domain?
My LED Cube →
  • or
    BTC
    1BLAWYYBP9ZGUwsJigtqW7JWLoaFFfZhMp
  • Contact

Proudly powered by WordPress Theme: Parament by Automattic.