2012-11-03

lighttpd instalation & configuration on Debian Squeeze

Install package's: 
lighttpd
php5-cgi
libsqlite3-dev
sqlite3
php5-sqlite
php5

All dependencies:
libonig2 (version 5.9.1-1) will be installed
libqdbm14 (version 1.8.77-4) will be installed
libsqlite0 (version 2.8.17-6) will be installed
libsqlite3-dev (version 3.7.3-1) will be installed
libterm-readkey-perl (version 2.30-4) will be installed
libterm-readline-perl-perl (version 1.0303-1) will be installed
lighttpd (version 1.4.28-2+squeeze1) will be installed
php5-cgi (version 5.3.3-7+squeeze14) will be installed
php5-common (version 5.3.3-7+squeeze14) will be installed
php5-sqlite (version 5.3.3-7+squeeze14) will be installed
php5-suhosin (version 0.9.32.1-1) will be installed       
sqlite3 (version 3.7.3-1) will be installed
php5 (version 5.3.3-7+squeeze14) will be installed


Enable fastcgi, by creating symbolic link:



# ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf

 10-fastcgi.conf need's to be updated:

$php-cgi -v



 PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cgi-fcgi) (built: Aug  6 2012 20:09:06)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH



$which php-cgi
$/usr/bin/php-cgi

#nano /etc/lighttpd/conf-enabled/10-fastcgi.conf


Content of file:
--------------------------------------------------------------------------------------------
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

server.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php.socket"
                 )))
--------------------------------------------------------------------------------------------
or 
--------------------------------------------------------------------------------------------
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

server.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" => ((
            "bin-path" => "/usr/bin/php-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"
                 )))
 --------------------------------------------------------------------------------------------
The module  fastcgi is added, and path to php-cgi is set! Good!

Restart server
# /etc/init.d/lighttpd restart

Create the file "index.php" to /var/www/
With Content:
--------------------------------------------------------------------------------------------
<?php phpinfo(); ?>
--------------------------------------------------------------------------------------------




This, helped me:

http://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html


No comments:

Post a Comment