Home > Web Development > Install Lighttpd with PHP FastCGI on Ubuntu 8.10

Install Lighttpd with PHP FastCGI on Ubuntu 8.10

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!

If this article has been helpful, please consider linking to it.

Categories: Web Development Tags: , ,

Related Posts

  1. November 9th, 2008 at 11:54 | #1

    Have you looked into nginx (http://nginx.net/)? I read about it a month or so ago in Linux Journal. Some big sites like Hulu.com use it.

  2. Rodrigo
    November 13th, 2008 at 08:12 | #2

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

  3. November 13th, 2008 at 08:15 | #3

    @Rodrigo – oops. Fixed.

  4. November 13th, 2008 at 09:34 | #4

    Did you get the performance gain(s) that you set out for when moving to lighttpd?

  5. lachie
    November 27th, 2008 at 02:29 | #5

    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?

  6. January 13th, 2009 at 14:18 | #6

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

    cheers