Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change 
notification.

The "PHP-FPM" page has been changed by msporleder:
https://wiki.apache.org/httpd/PHP-FPM?action=diff&rev1=2&rev2=3

Comment:
add performance and pitfalls section.  remove some over-familiar tone

   IMPORTANT! __Read the above again__
   $1:: expands to the entire request-URI from the original request, minus the 
leading slash (because we already added that above.)
  ----
- An example, you say ? Very well, have an
+ 
  ==== example ====
  Say you want to be able to conjure up the standard php info page listing all 
compiled-in and loaded extensions, and all runtime configuration options and 
script info.
  
@@ -95, +95 @@

    
  This is a very simple example, mapping one unique URL to a single PHP file.
  
- Aha, I hear you say - so what about something that's actually useful ?
- 
  In case you want to proxy '''all''' `.php` files in your vhost to the fcgi 
server using their real php file locations, you can use a more flexible match:
   `ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/$1`
  Again, assuming `/var/www` is the documentroot of the vhost in question.
  
  __Don't forget to reload apache after making any changes to a vhost or other 
configuration file.__
+ 
+ ==== Performance and Pitfalls ====
+ mod_proxy_fcgi only supports network sockets ( 
[[https://issues.apache.org/bugzilla/show_bug.cgi?id=54101|Unix socket support 
for mod_proxy_fcgi]] )
+ 
+ It is easy to overwhelm your system's available sockets, pass over ulimits, 
etc.  Some tips to avoid this:
+ 
+ Using too many sockets will cause apache to give a `(99)Cannot assign 
requested address:` error.  This means your operating system is not allowing 
new sockets to be created.
+ 
+ On linux you can use /proc/sys/net/ipv4/tcp_tw_reuse to not build up as many 
sockets, but there are warnings associated with using this behind a NAT.
+ 
+ Be sure to modify ulimit and allow for enough open files and processes for 
both the apache user and the php-fpm user.
+ `ulimit -n` and `ulimit -u`  (nofile and nproc)
+ 
+ If php-fpm does not have a large enough nproc it will exit (`code 255`, no 
additional information as of php 5.3) in a loop without additional messages.
+ 
+ If php-fpm does not have a large enough nofile you will probably not be able 
to get logging per child, as shown above.  It will give this in the general 
error log.
+ 
+ If apache and php-fpm run as the same user (not necessary or recommended) and 
nproc is too small, apache will not startup with the following message 
`(11)Resource temporarily unavailable: AH02162: setuid: unable to change to 
uid: 600`
  
  ==== Caveat ====
  One might be tempted to point out that a greedy ProxyPassMatch directive 
might allow some malicious content uploaded by a HTTP client to be served.

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscr...@httpd.apache.org
For additional commands, e-mail: docs-h...@httpd.apache.org

Reply via email to