You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by Apache Wiki <wi...@apache.org> on 2016/06/14 23:28:52 UTC
[Httpd Wiki] Update of "PHP-FPM" by thumbs
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 thumbs:
https://wiki.apache.org/httpd/PHP-FPM?action=diff&rev1=7&rev2=8
Comment:
Added table of contents and recipe for the handler approach to check for the existence of files first
+ <<TableOfContents()>>
+
= High-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpm. =
With the release of apache httpd 2.4 upon an unsuspecting populace, we have gained some very neat functionality regarding apache and php: the ability to run PHP as a fastCGI process server, and address that fastCGI server ''directly from within apache'', via a dedicated proxy module (mod_proxy_fcgi.)
@@ -111, +113 @@
''Note that with this approach, the captured request URI ($1) is not passed after the path''
+ === Proxy via handler ===
+
+ With this approach, you can check for the existence of the resource prior to proxying to the php-fpm backend.
+
+ `# Defining a worker will improve performance`
+
+ `# And in this case, re-use the worker (dependent on support from the fcgi application)`
+
+ `# If you have enough idle workers, this would only improve the performance marginally`
+
+ `<Proxy "fcgi://localhost:9000/" enablereuse=on max=10>`
+
+ `</Proxy>`
+
+
+ `<FilesMatch "\.php$">`
+
+ ` # Pick one of the following approaches`
+
+ ` # Use the standard TCP socket`
+
+ ` #SetHandler "proxy:fcgi://localhost/:9000"`
+
+ ` # If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket`
+
+ ` #SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"`
+
+ `</FilesMatch>`
+
+
=== 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.
@@ -139, +171 @@
=== Performance and Pitfalls ===
- mod_proxy_fcgi now supports network sockets since 2.4.9 ( [[https://issues.apache.org/bugzilla/show_bug.cgi?id=54101|Unix socket support for mod_proxy_fcgi]] )
+ mod_proxy_fcgi now supports unix domain sockets since 2.4.9 ( [[https://issues.apache.org/bugzilla/show_bug.cgi?id=54101|Unix domain 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:
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org