30 Jan, 2009 in
PHP by
admin
How to Install Lighttpd with PHP5 and MySQL on CentOS 5.2
Lighttpd is software webserver designed to be secure, fast, standars-complaint, and flexible while being optimized for
speed-critical environments. This post using Centos 5.2.
1. Install Mysql
[root@rhesa ~]# yum -y install mysql mysql-server
2. Create the system startup links for MySQL
[root@rhesa ~]# chkconfig –levels 235 mysqld on
[root@rhesa ~]# /etc/init.d/mysqld start
3. Create Password for user mysql
[root@rhesa ~]# mysqladmin -u root password password123
4. Check service with
[root@rhesa ~]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 19852/mysqld
5. Set a Mysql password for your hostname
[root@rhesa ~]# mysqladmin -h rhesa.swiftco.net -u root password password123
6. Installing Lighttpd
[root@rhesa ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@rhesa ~]# yum -y install lighttpd
7. Create the system startup links for Lighttpd
[root@rhesa ~]# chkconfig –levels 235 lighttpd on
[root@rhesa ~]# /etc/init.d/lighttpd start
8. Check service lighttpd
[root@rhesa ~]# netstat -tap | grep lighttpd
tcp 0 0 *:http *:* LISTEN 28352/lighttpd
9. Installing PHP5
[root@rhesa ~]# yum install lighttpd-fastcgi php-cli
10. Add the line cgi.fix_pathinfo = 1 right at the end of the file /etc/php.ini
[root@rhesa ~]# nano /etc/php.ini
cgi.fix_pathinfo = 1
11. Uncomment “mod_fastcgi”, in the /etc/lighttpd/lighttpd.conf
[root@rhesa ~]# nano /etc/lighttpd/lighttpd.conf
# “mod_rewrite”,
# “mod_redirect”,
# “mod_alias”,
“mod_access”,
# “mod_cml”,
# “mod_trigger_b4_dl”,
# “mod_auth”,
# “mod_status”,
# “mod_setenv”,
“mod_fastcgi”,
# “mod_proxy”,
# “mod_simple_vhost”,
# “mod_evhost”,
# “mod_userdir”,
# “mod_cgi”,
# “mod_compress”,
# “mod_ssi”,
# “mod_usertrack”,
# “mod_expire”,
# “mod_secdownload”,
# “mod_rrdtool”,
“mod_accesslog” )
And then uncomment this line
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/bin/php-cgi”
)
)
)
12. Restart service lighttpd
[root@rhesa ~]# /etc/init.d/lighttpd restart
13. Testing PHP5
[root@rhesa ~]# nano /srv/www/lighttpd/info.php
<?php
phpinfo();
?>
sam | March 1st, 2009 at 3:00 pm #
your tutorial got me up and running on centos but i had to create a directory /var/run/lighttpd for lighttpd to start for some reason.
thanks