Table of Contents |
---|
High-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpm.
...
- starting from release 5.3.3 in early 2010, PHP has merged the php-fpm fastCGI process manager into its codebase, and it is now (as of 5.4.1) quite stable.
- php-fpm was previously found at http://php-fpm.org/
This means that we can now run secure, fast, and dependable PHP code using only the stock apache httpd and php.net releases; no more messing around with suphp or suexec - or, indeed, mod_php.
...
- installing software packages
- editing configuration files
- controlling service daemons.
From release 5.3.3 onwards, PHP now includes the fastCGI process manager (php-fpm) in the stock source code.
...
prerequisites:
- editing httpd.conf
- understanding the vhost context
- understanding URL-to-filesystem namespace mapping
- controlling the apache httpd daemon
This release of apache httpd has introduced two noteworthy features: a new proxy module specifically for fastCGI (mod_proxy_fcgi), and the move to the event MPM as the default apache process manager.
...
If such restrictions cannot be implemented easily, then checks could be performed prior to proxying with a RewriteCond or FallbackResource to ensure that the URI is not altered by the HTTP client.
Experiments with timeouts
For long-running scripts, setting a large timeout might help. This approach will set the time out value to 300 seconds, and allow you to be selective about what requests are proxied:
<Proxy "unix:/var/run/php-fpm/example.com.sock|fcgi://localhost">
ProxySet timeout=300
</Proxy>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://localhost"
</FilesMatch>