On this page
- Installing Lighttpd With PHP5 And MySQL On CentOS 5.2
- What is Lighttpd?
- 1. Install MySQL
- 2. Create the system startup links for MySQL
- 3. Create Password for the MySQL root User
- 4. Check if MySQL Networking is enabled
- 5. Set a MySQL password for your hostname
- 6. Installing Lighttpd
- 7. Create the system startup links for Lighttpd
- 9. Installing PHP5
- 10. Add the line cgi.fix_pathinfo = 1 right at the end of the file /etc/php.ini
- 11. Uncomment "mod_fastcgi" in the file /etc/lighttpd/lighttpd.conf
- 12. Restart service lighttpd
- 14. Now check in browser http://localhost/info.php
- 15. Getting MySQL in PHP5
- 16. Restart service lighttpd
Installing Lighttpd With PHP5 And MySQL On CentOS 5.2
What is Lighttpd?
Lighttpd is a webserver designed to be secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments. This post shows how to install it with PHP5 and MySQL support on Centos 5.2.
1. Install MySQL
[root@server ~]# yum -y install mysql mysql-server
2. Create the system startup links for MySQL
[root@server ~]# chkconfig --levels 235 mysqld on
[root@server ~]# /etc/init.d/mysqld start
3. Create Password for the MySQL root User
[root@server ~]# mysqladmin -u root password server123
4. Check if MySQL Networking is enabled
[root@server ~]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 19852/mysqld
5. Set a MySQL password for your hostname
[root@server ~]# mysqladmin -h localhost -u root password server123
6. Installing Lighttpd
[root@server ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@server ~]# yum -y install lighttpd
7. Create the system startup links for Lighttpd
[root@server ~]# chkconfig --levels 235 lighttpd on
[root@server ~]# /etc/init.d/lighttpd start
8. Check service lighttpd
[root@server ~]# netstat -tap | grep lighttpd
tcp 0 0 *:http *:* LISTEN 28352/lighttpd
9. Installing PHP5
[root@server ~]# 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@server ~]# nano /etc/php.ini
cgi.fix_pathinfo = 1
11. Uncomment "mod_fastcgi" in the file /etc/lighttpd/lighttpd.conf
[root@server ~]# nano /etc/lighttpd/lighttpd.conf
server.modules = ( # "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 these lines:
#### 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@server ~]# /etc/init.d/lighttpd restart
13. Testing PHP5
[root@server ~]# nano /srv/www/lighttpd/info.php
<?php phpinfo(); ?>
14. Now check in browser http://localhost/info.php
15. Getting MySQL in PHP5
[root@server ~]# yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
16. Restart service lighttpd
[root@server ~]# /etc/init.d/lighttpd restart
and check using http://localhost/info.php.