Talk:Fastcgi


 * http://www.cyberciti.biz/faq/freebsd-apache22-fastcgi-php-configuration/
 * http://www.cyberciti.biz/faq/freebsd-apache-php-mod_fastcgi-tutorial/
 * http://personal.x-istence.com/post/2009/08/25/moving-modfastcgi-modfcgid

mod_fcgid на apahce2
src

 Do not try and use MAILHEAD and SUHOSIN together; that combination is broken. Install the /lang/php5-extensions you require. Currently there seems to be a problem with extension=sqlite.so, and since I don't use/need it's commented out of my extensions.ini.

Install www/mod_fcgid from ports. In httpd.conf use:

LoadModule fcgid_module libexec/apache22/mod_fcgid.so

instead of the usual:

LoadModule php5_module       libexec/apache22/libphp5.so

Also, further down in httpd.conf:

[...] 
 * 1) This should be changed to whatever you set DocumentRoot to.

[...]




 * 1) added to enable mod_fcgid

 AddHandler fcgid-script .fcgi .php SocketPath /var/run/fcgidsock/ IPCConnectTimeout 10 IPCCommTimeout 20 OutputBufferSize 0 

 DirectoryIndex index.html index.php  [...]
 * 1) DirectoryIndex: sets the file that Apache will serve if a directory
 * 2) is requested.
 * 1) is requested.

If all went well you should be able to restart Apache and be in business. A phpinfo; should execute and provide details. Any problems the quickest way to check PHP is to just execute php -v at a shell prompt. If it doesn't segfault it will print out a short descriptive output text.

I believe this is better than the usual script based approach you will locate on the web. It starts/spawns PHP as a long running process when Apache starts instead of starting a new CGI each time PHP script is executed.

The mod_fcgid is configurable:

http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

I believe this project was fairly recently folded into the Apache.org umbrella, but when I began it was separate and standalone. The docs on the Apache site look like they are for the upcoming 2.3 update to 2.2, and there may be discrepancies present. I had originally used the docs from the old site and I don't know if they are even still available.

-Mike

P.S. - Also, if you need to use Alias they will look like this:

Alias  /xcache-admin   "/usr/local/share/examples/xcache/admin/"  #SetHandler None FCGIWrapper /usr/local/bin/php-cgi .php Options ExecCGI Order allow,deny Allow from 192.168.10.2 Deny from none  