Lighttpd, PHP, and MySQL on CentOS 5
I’m logging down the installation procedure for a LLMP stack on the CentOS Linux distribution, mostly for my own reference. Because who am I kidding? No one reads this blog anyways. :]
Step 1) Installing & Configuring MySQL
yum install mysql mysql-serverchkconfig --levels 235 mysqld on && /etc/init.d/mysqld start- Sets MySQL to start up when the system boots, and starts the mysql daemon.
mysqladmin -u root password your_new_password- Set a root password for your MySQL installation.
Step 2) Installing & Configuring Lighttpd
- If you’re installing on an x86_64 machine:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm && rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm - If you’re installing on an i386 machine:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm && rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm yum install lighttpdchkconfig --levels 235 lighttpd on && /etc/init.d/lighttpd start- Sets Lighttpd to start up when the system boots, and starts the Lighttpd daemon.
- Lighttpd’s default document root is /srv/www/lighttpd, you can use this or change it by editing the configuration file /etc/lighttpd/lighttpd.conf and restarting Lighttpd.
Step 2) Installing & Configuring PHP5 (via FastCGI)
yum install lighttpd-fastcgi php-cliecho cgi.fix_pathinfo = 1 >> /etc/php.ini- Inserts option to use the real path information for CGI.
vi /etc/lighttpd/modules.conf- Edit Lighttpd’s module configuration file and uncomment the toggle for mod_fastcgi by removing the hash (#) symbol at the beginning of the line.
cp /etc/lighttpd/conf.d/fastcgi.conf /etc/lighttpd/fastcgi.conf-bak- Back up the default FastCGI module configuration.
vi /etc/lighttpd/conf.d/fastcgi.conf- Replace the contents of fastcgi.conf with the following:
fastcgi.server = ( ".php" => ( "localhost" => ( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/bin/php-cgi" ) ) )
- Replace the contents of fastcgi.conf with the following:
Step 3) Adding MySQL support to the PHP installation
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
Step 4) Finalizing and testing Lighttpd, PHP, and MySQL stack
/etc/init.d/lighttpd restart
Create a phpinfo.php file in your document root, and browse to /phpinfo.php to verify the installation.
Cheers!



