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 site has been useful, please consider participating in the Fundraiser.

Other Points of Interest

  • No Related Post

Comments

5 Responses to “Install Lighttpd with PHP FastCGI on Ubuntu 8.10”

  1. Eric Lake on November 9th, 2008 11:54 am

    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 on November 13th, 2008 8:12 am

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

  3. Christer Edwards on November 13th, 2008 8:15 am

    @Rodrigo - oops. Fixed.

  4. Fredrik Wendt on November 13th, 2008 9:34 am

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

  5. lachie on November 27th, 2008 2:29 am

    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?

Leave a Comment




    Subscribe to the RSS feed!


    subscribe to the ubuntu tutorials RSS feed

    Ubuntu Tutorials Fundraiser


    Please Donate to
    Server Improvement

    Target amount: USD1,000.00
    Total Donations: USD328.00
    Amount Needed: USD672.00

    Thank you for your support!

    Click to Donate

    Polls



  • Blogroll

  • Ads by Google