Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The "php-fcgid" page has been changed by thumbs: https://wiki.apache.org/httpd/php-fcgid?action=diff&rev1=8&rev2=9 Comment: Removed confusing distro-specific segment, and clarified some sentences. == Why ? == * Because mod_php forces you to load prefork MPM, which is inefficient. * Because mod_php will be loaded into httpd's memory even when serving static pages - * Most distributions shipping in 2013 provide precompiled packages that let you run php with fcgid. This is just a matter of configuration. + * Most distributions shipping in 2013 provide pre-compiled packages that let you run php with fcgid. This is just a matter of configuration. * mod_fcgid is an official Apache module, available at [[http://httpd.apache.org/mod_fcgid/]] == Benefits == @@ -18, +18 @@ Follow '''ALL''' steps, or something will be missing in the end. + 1. Unload mod_php by commenting out the [[http://httpd.apache.org/docs/current/mod/mod_so.html#loadmodule|LoadModule]] directive from your configuration. + 2. Load the mod_fcgid module with the [[http://httpd.apache.org/docs/current/mod/mod_so.html#loadmodule|LoadModule]] directive. + 3. Install PHP as CGI using your package manager. - 1. Get rid of mod_php. You need to comment out the "LoadModule php5_module" from your configuration. - ''On debian, just run "apt-get remove libapache2-mod-php5"'' - 2.#2 Install mod_fcgid - '' On debian, "apt-get install libapache2-mod-fcgid"'' - 3.#3 Install PHP as CGI - ''On debian, "apt-get install php5-cgi"'' - 4.#4 Write a small wrapper, such as this : /usr/local/bin/php-wrapper + 4. Write a small wrapper, such as this : /usr/local/bin/php-wrapper ---- #!/bin/sh @@ -42, +39 @@ exec /usr/lib/cgi-bin/php5 ---- + Make sure it is readable and executable by the apache user/group. 5.#5 Configuration - httpd.conf - LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so + LoadModule fcgid_module <path to modules>/mod_fcgid.so AddHandler fcgid-script .php FcgidWrapper /usr/local/bin/php-wrapper .php + 6.#6 Replace prefork MPM with a threaded MPM, such as '''worker'''. On 2.4, you can now change the active mpm by loading the appropriate module. - - 6.#6 Replace prefork MPM with a threaded MPM, such as '''worker'''. - ''On debian, just run "apt-get install apache2-mpm-worker"'' == FAQ / It doesn't work == - Don't panic. Check apache error log. + Don't panic. Check apache httpd error log. === PHP files are downloaded, not interpreted === If you have a handler already set for PHP, it may be conflicting. --------------------------------------------------------------------- To unsubscribe, e-mail: docs-unsubscr...@httpd.apache.org For additional commands, e-mail: docs-h...@httpd.apache.org