Installing lighttpd with php5 support and MySQL on Debian Lenny

by admin on February 7, 2010 · 0 comments

in Apache, Lighttpd, Tutorials, Web Servers

We Assume That The User Has Basic Knowledge To Use SSH Commands

In this tutorial we will be installing Lighttpd with PHP5 and MySQL Support On Debian Lenny.
First we will login to the server as root and make sure that every package is up-to date.

apt-get install lighttpd



Now Lighty is installed.. here are some commands that you can use to control Lighty.
To Start Lighttpd

/etc/init.d/lighttpd start

To Stop Lighttpd

/etc/init.d/lighttpd stop

To Restart Lighttpd

/etc/init.d/lighttpd restart

Next , we will install php and mysql packages.

apt-get install mysql-server php5-cgi php5-mysql

During installation of MySQl it will prompt to set a password.You are advised to set a strong password..

we will restart Lighttpd

/etc/init.d/lighttpd restart

No we have to configure lighttpd config so that it can handle PHP files.

cat > /etc/lighttpd/conf-enabled/10-cgi-php.conf
server.modules += (“mod_cgi”)
cgi.assign = (“.php” => “/usr/bin/php5-cgi”)^D

We now will restart lighttpd so that new configuration will be applied..

/etc/init.d/lighttpd restart

we can test the working of PHP by creating a PHP info file..

nano /var/www/phpinfo.php

<?php phpinfo(); ?>

Now open phpinfo.php from your browser..and you should be able to see the output of phpinfo() function.



Leave a Comment

Previous post:

Next post: