(转)[HowTo] Ubuntu, Lighttpd and PHP5

来源:互联网 发布:下载命中双色球软件 编辑:程序博客网 时间:2024/06/14 17:30

http://hqman.javaeye.com/blog/180374

 

Here’s the whole procedure for anyone who is interested.

$ sudo apt get install lighttpd php5-cgi
$ sudo lighty-enable-mod fastcgi

Lighty is installed and running with fastcgi support and PHP is installed, too. Now we only have to change some configuration options to actually make PHP run inside lighty.
Open lighty’s fastcgi.conf

$ gksudo gedit /etc/lighttpd/conf-enabled/10-fastcgi.conf

Change:

## Start an FastCGI server for php4 (needs the php4-cgi package)
fastcgi.server    = ( ".php" =>
    ((
        "bin-path" => "/usr/bin/php4-cgi",
        "socket" => "/tmp/php.socket",
        "max-procs" => 2,
        "idle-timeout" => 20,
        "bin-environment" => (
            "PHP_FCGI_CHILDREN" => "4",
            "PHP_FCGI_MAX_REQUESTS" => "10000"
        ),
        "bin-copy-environment" => (
            "PATH", "SHELL", "USER"
        ),
        "broken-scriptfilename" => "enable"
    ))
)

to:

## Start an FastCGI server for php5 (needs the php5-cgi package)
fastcgi.server    = ( ".php" =>
    ((
        "bin-path" => "/usr/bin/php5-cgi",
        "socket" => "/tmp/php.socket",
        "max-procs" => 1,
        "idle-timeout" => 20,
        "bin-environment" => (
            "PHP_FCGI_CHILDREN" => "2",
            "PHP_FCGI_MAX_REQUESTS" => "10000"
        ),
        "bin-copy-environment" => (
            "PATH", "SHELL", "USER"
        ),
        "broken-scriptfilename" => "enable"
    ))
)

You can change the “max-procs” and “PHP_FCGI_CHILDREN” if you really need to, but I found the values as seen above to be perfectly suited for development.
Restart lighty like this:

$ sudo /etc/init.d/lighttpd force-reload

原创粉丝点击