beta.blog

Debian: Installing Lighttpd with PHP5

by on Dec.10, 2011, under Linux (Ubuntu)

Short tutorial of how to install Lighttpd with PHP support under Debian/Ubuntu.

1. First of all install Lighttpd:

apt-get install lighttpd -y --force-yes

2. Then install PHP (with FastCGI):

apt-get install php5-cgi -y --force-yes

3. Activate FastCGI and restart lighttpd (thanks to a user comment!):


sudo /usr/sbin/lighty-enable-mod fastcgi
sudo /usr/sbin/lighty-enable-mod fastcgi-php
sudo service lighttpd restart

Manual method of activating FastCGI support:

If step 3 didn’t work for you for some reason you may activate this module manually as well.

1. Edit the Lighttpd configuration file:

vim /etc/lighttpd/lighttpd.conf

2. At the top of the file where it says server.modules =  add the following line:

"mod_fastcgi",

This line will enable the Lighttpd-Module “fastcgi” which will be responsible for the execution of PHP scripts.

3. If you want to use FastCGI add the following code at the bottom of the configuration file:

fastcgi.server = ( ".php" => ((
                    "bin-path" => "/usr/bin/php-cgi",
                    "socket" => "/tmp/php.sock"
                )))

4. Save your changes and restart Lighttpd via the command:

/etc/init.d/lighttpd restart

1 Comment for this entry

  • me

    sudo /usr/sbin/lighty-enable-mod fastcgi
    sudo /usr/sbin/lighty-enable-mod fastcgi-php

    sudo service lighttpd restart

Leave a Reply

*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!