Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Jason Hoffman http://textdrive.com/

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

Minimal extension-less build of PHP-CGI-FCGI

But what you do is add the --with-config-file-scan-dir where you add an extra extensions.ini file that dynamically loads different php extensions that you compile separately.

You will need to have compiled and installed libxml into /usr/local/ or if you are on Mac's Tiger, you can change the path to /usr and that should do ya.

./configure --enable-memory-limit --with-layout=GNU --with-config-file-scan-dir=/usr/local/etc/php --disable-all --enable-libxml --with-libxml-dir=/usr/local --enable-spl --with-regex=php --disable-cli --enable-force-cgi-redirect --enable-fastcgi


And you don't want to leave that /usr/local/bin/php binary sitting there because it's cgi-fcgi, you're going to replace it with php-cli

mv /usr/local/bin/php /usr/local/bin/php-fcgi


/usr/local/bin/php-fcgi is then the binary you use for all PHP CGI and FCGI.

My lighttpd php-fastcgi config with it's own php.ini

fastcgi.server = (
                ".php" =>
                    ( "localhost" =>
                        (
                            "socket" => "/home/jah/tmp/jah-php5-fcgi.socket",
                            "bin-path" => "/usr/local/www/cgi-bin/php5-fcgi -c /home/jah/etc/php.ini",
                            "bin-environment" => (
                            "PHP_FCGI_CHILDREN" => "4",
                            "PHP_FCGI_MAX_REQUESTS" => "5000"
                                                 )
                        )
                    )
                 )

Suexec'ed PHP-FastCGI on Apache2

A PHP cgi binary compiled with fcgi support

> /usr/local/www/cgi-bin/php5-fcgi -v
PHP 5.0.3 (cgi-fcgi) (built: Dec 30 2004 22:44:32)


Central config in httpd.conf

<IfModule mod_fastcgi.c>
FastCgiIpcDir /usr/local/www/fcgi_ipc/tmp
AddHandler fastcgi-script .fcgi
FastCgiSuexec /usr/local/sbin/suexec
FastCgiConfig -singleThreshold 100 -killInterval 300 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION
IfModule>
/php-fastcgi/>
Options ExecCGI        
SetHandler fastcgi-script
Location>


In a virtual host

SuexecUserGroup ${USER} ${GROUP}
ScriptAlias /php-fastcgi/ ${HOME}/php-fastcgi/ 
AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp /php-fastcgi/php5-fcgi


And then the ${HOME}/php-fastcgi/php5-fcgi wrapper

#!/bin/sh 
PHPRC="/usr/local/etc" 
export PHPRC 
PHP_FCGI_CHILDREN=8 
export PHP_FCGI_CHILDREN 
PHP_FCGI_MAX_REQUESTS=5000 
export PHP_FCGI_MAX_REQUESTS 
exec /usr/local/www/cgi-bin/php5-fcgi 


The PHPRC environment sets the directory where php.ini is to be found
« Newer Snippets
Older Snippets »
3 total  XML / RSS feed