Php configuration on lighttpd

Source: Internet
Author: User
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 ")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.