Install Lighttpd with PHP FastCGI on Ubuntu 8.10

By | 2008/11/09

In my attempts to performance tune the blog I’ve been looking at alternate web servers, primarily lighttpd.  One of the initial issues that I had with an attempted migration was that of enabling php.  With Apache php had been simple, but lighttpd needed a bit more.

To install a php fastcgi enabled web server using lighttpd you’ll need the following packages:

sudo aptitude install lighttpd php5-cgi

The trick after installing is to activate the fastcgi module included with lighttpd.  This is done using:

sudo lighttpd-enable-mod fastcgi
sudo /etc/init.d/lighttpd reload

In order to test this you can create a file within your document root (likely /var/www/) called info.php, with the following contents (remove the excess spaces):

< ? php
phpinfo();
? >

Now you should be able to access your site, http://example.com/info.php.  If you get a fancy list of php options you’re done!

6 thoughts on “Install Lighttpd with PHP FastCGI on Ubuntu 8.10

  1. Rodrigo

    The command to enable the fastcgi module is wrong. It has to say: sudo lighttpd-enable-mod fastcgi
    Thanks.

    Reply
  2. lachie

    hello when i did this it didnt work
    if i went to my site
    and opend a php file
    it would try to download it
    wtf?

    Reply
  3. antonio

    great tip, saved me some digging, thanks mate 🙂 had it installed before on fc8, changed to ku8.10 now.

    cheers

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.