PHP and PHP
Fastcgi Configuration in Lighttpd
Lighttpd supports PHP through both CGI and FastCGI. As the name
suggests, FastCGI is preferable.
FastCGI is a language independent, scalable, open extension to
CGI that provides high performance without the limitations of
server specific APIs.
FastCGI provides better scalability and performance. Instead of
creating a new process (the CGI program) for every request,
FastCGI uses a single persistent process which handles many
requests over its lifetime.
In all our tests it has shown better performance than Apache
1.3.x + mod_php4. See
http://www.lighttpd.net/benchmark/ for the results.
Does it support opcode cachers like APC, TurckMM, XCache and
YES! Even if their docs say they do not work in CGI. Under
lighttpd, PHP is usually run as FastCGI which supports those
opcode cachers like mod_php4 in Apache.
http://eaccelerator.net/ (Successor of Turck mmCache)
XCache, Installing XCache (new, well tested, running with
Installing PHP and FasiCGI in Debian
#apt-get install php4 php4-cgi
This will complete the installation of PHP and FastCGI supported
Now you need to find the exact versions are installed or not
using the following commands
# php -v
# php-cgi -v
You must get string cgi-fcgi. Next find out full path to php-cgi:
# which php-cgi
Open lighttpd configuration file:
# vi /etc/lighttpd/lighttpd.conf
First add the module mod_fastcgi (lighttpd provides an interface
to a external programs that support the FastCGI interface via
this module). Make sure your server.modules loades mod_fastcgi:
server.modules = (
Now add following lines to configuration:
fastcgi.server = ( “.php” => ((
“bin-path” => “/usr/bin/php-cgi”,
“socket” => “/tmp/php.socket”,
Save the configuration and close all the files. If you want more configuration Options for
Restart the lighttpd:
# /etc/init.d/lighttpd restart
Test your configuration by running php program or application.
Main Source of article can be found