The default packages built-in my CentOS box are Apache HTTP Server 2.2 and PHP 5.1. If we want to replace them with Lighttpd and PHP 5.3, we need some modification to the system. This post is an annotation of the procedure.
1. The Lighttpd package is not provided by official repository. We need to add the support via EPEL x86_64 repository (I’m using 64-bit CentOS):
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
2. After update, we can install lighttpd:
# yum install lighttpd lighttpd-fastcgi
3. Update PHP from 5.1 to 5.3, first we need to list all installed 5.1 packages:
# rpm -qa | grep php and then to remove them all.
4. Install the PHP53 and related packages we need:
# yum install php php-cli php-mysql.
Note: The PHP53 packages also install httpd packages which we cannot removed individually.
5. Enable fastcgi support for Lighttpd in /etc/lighttpd/lighttpd.conf as this reference: lighttpd + FastCGI in CentOS.
Note: The cgi.fix_pathinfo=1 configure is installed by default in /etc/php.d/lighttpd.ini and we can skip to set it up.
6. Finally, the most important step for some application use sessions. We need to set up the permissions by:
# chown -R root:lighttpd /var/lib/php because the web server we use is not httpd. If we do not set this, some application like phpMyAdmin we raise error while login.
7. Restart the Lighttpd and enjoy it. 🙂