Linux.com

Home Learn Linux Linux Documentation Linux How Tos Installing Lighttpd with PHP5 on Ubuntu 9.10

Installing Lighttpd with PHP5 on Ubuntu 9.10

First step is to install Lighttpd server. Install it using following command:

$ apt-get install lighttpd

This should install lighttpd on your system. All the lighttpd related configurations can be found at /etc/lighttpd/

Next step is to start Lighttpd server:

$ /etc/init.d/lighttpd start

As per default configuration ( at /etc/lighttpd/lighttpd.conf ), lighttpd will be started at port 80. Point the server to:

http://localhost

This should display Lighttpd Welcome Page.

To make PHP work with Lighttpd we have to install PHP with CGI. To install it:

$ apt-get install php5-cgi

This will install PHP with CGI.

Now goto /etc/lighttpd/conf-available directory. Here you will get a file called 10-fastcgi.conf. This is the configuration file for setting up PHP to work with Lighttpd. You can change the configuration as per your requirements.

You can either copy this file to /etc/lighttpd/conf-enabled/ or create a symbolic link to it:

ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf

Finally we need to restart Lighttpd:
$ /etc/init.d/lighttpd restart
 
To test weather we can run PHP create a file called test.php in server.document-root path ( defined in /etc/lighttpd/lighttpd.conf )
 
<?php
 
phpinfo();
 
?>
 
And now point the browser to http://localhost/test.php. Here you should be able to see phpinfo page.
 

Comments

Subscribe to Comments Feed

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board