First, use php-cgi-v to check whether php supports fastcgi. The output on my machine is as follows:
PHP 5.2.4-2ubuntu5. 1 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: May 9 2008 16:26:18)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend RJL
Then locate the php-cgi location:
Which php-cgi
Output:/usr/bin/php-cgi
For the latest version of lighttpd, the configuration file has been processed more rationally. many online tutorials have suggested modifying/etc/lighttpd. conf. If a newer version is installed, there is a 10-fastcgi.conf file under/etc/lighttpd/conf-avalile.
Back up the data:
Sudo cp 10-fastcgi.conf bak.10-fastcgi. conf
Then open:
Sudo vim 10-fastcgi.conf
The simplest configuration for adding or modifying content is as follows:
Fastcgi. server = (
". Php" => ((
"Bin-path" => "/usr/bin/php-cgi" # position found in the which php-cgi section above
"Socket" => "tmp/php. socket"
))
)
Of course, you can also configure a lot of other content, such as max-proces/idle-timeout. Restart lighttpd after the configuration is complete:
Sudo/etc/init. d/lighttpd restart
-----If you want to start .ing from .html to. php
You must first disable the mod_compress module. The initial configuration in the lighttpd. conf file is:
Server. modules = (
13 "mod_access ",
14 "mod_alias ",
15 "mod_accesslog ",
16 "mod_compress ",
17 # "mod_rewrite ",
....
....
Compress. cache-dir = "/var/cache/lighttpd/compress /"
Compress. filetype = ("text/plain", "text/html", "application/x-javascript", "text/css ")
....
....
There are two options: describe mod_compressand decompress the. html file. here, remove text/html from compress. filetype.
Then enable 10-fastcgi.conf and add
Fastcgi. map-extensons = (". html" => ". php ")