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!
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.
The command to enable the fastcgi module is wrong. It has to say: sudo lighttpd-enable-mod fastcgi
Thanks.
@Rodrigo – oops. Fixed.
Did you get the performance gain(s) that you set out for when moving to lighttpd?
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?
great tip, saved me some digging, thanks mate 🙂 had it installed before on fc8, changed to ku8.10 now.
cheers