Let me share with you my research on the web about the advantages and disadvantages of Lighttpd vs. Apache, and how it might possible affect your applications ins PHP. The following article is a compilation of what I have found on different sites on the net.
Lighttpd or “Lighty” is a lightweight webserver made with speed and load balancing in mind, Unlike Apache which comes with a lot of modules that consumes a lot of server resources. One of the features of Lighttpd is that it is an event-driven web server. It uses select/poll/epoll/kqueue from a single process/thread.
Now for the Pros and Cons:
Pros:
Compared to Apache, it has a smaller CPU and memory usage. Since Lighttpd uses fewer resources per request than Apache alone, it can generally serve most static content faster than Apache.
Lighttpd has a better load-balancing than Apache
Lighttpd has easier configuration options compared to Apache
Lighttpd is recommended for static content, or dynamic content that is cached as a static page.
PHP has a better performance under Lighty due to its FastCGI module (which has its own disadvantage. see below)
Because of its FastCGI module, the server and application processes can be restarted independently which is important for busy websites
Also because of the FastCGI module, per-application security policies can be implemented
Cons:
Lighttpd doesn’t have support for .htaccess files which might break current security / functionality implementations for some of your applications (i.e. HTTP authentication)
Using Lighttpd will only support PHP running under FastCGI as opposed to running it as a module (mod_php) which might have additional implications for the application and server (PEAR modules won’t work under FastCGI)
Lighttpd has some problems processing request headers (specifically CR anf LF) from browsers like Opera. For example, Opera under SSL will hang under Lighttpd.
Lighttpd is incompatible with Apache modules (i.e. mod_security), and has its own module repository. Lighttpd has a smaller module repository compared to apache, and has a limited community which might become a problem when needing support.
Lighttpd doesn’t support some control panel applications like cPanel or Plesk and will require special configurations to run them
Given these Pros and Cons, its really hard to decide when to do a switch to Lighty. But as a basic rule, for server only serving mostly static content, Lighty is the better choice since it lesser overhead than Apache. Youtube’s video servers which serves static content runs on Lighty.
However, if you are on the fringe case wherein you need Apache’s functionality, but lacking on server resources, and an upgrade is not a viable option, there is some good news for you. Lighttpd can be run behind Apache via Apache’s proxy module. Instructions on doing this can be found on this article:
Running Lighttpd through Apache’s proxy module
So what does this basically mean? In short, we can let Apache handle the dynamic content, while we let Lighty handle the static content from a server.
Related links:
Official Lighttpd Website
Official Apache Website
Official FastCGI Website