Run PHP with a light weight webserver | box.matto.nl
Multiple light-weight httpd server
In search for a lightweight solution to run some php pages on my Debian diskless shellserver it appears there are several lightweight httpd daemons in Debian that can do php.
I created some virtual machines on KVM to do some testing. Here follows a short howto to get the different httpd servers running 🙂
Howto install lightweigt httpd daemons with PHP support
Debian comes with several httpd daemons. On this page we look at the following httpd servers:
Lighthttpd
Cherokee
Nginx
Nginx requires the most work.
Lighthttpd with PHP
apt-get install mysql-server mysql-client
apt-get install lighttpd
comment this line out in /etc/lighttpd/lighttpd.conf include_shell « /usr/share/lighttpd/use-ipv6.pl »
check that lighthttpd is running.
Point your browser to http://<ip-number>
screenshot of lighttpd
Screenshot of lighttpd just after installing
apt-get install php5-cgi
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/
/etc/init.d/lighttpd restart
PHP ready to use
Your server should be ready to use PHP now. To test it, create a file info.php in /var/www. The contents of the file should be something like this:
<?
phpinfo();
?>
screenshot of lighttpd running php info
Screenshot of lighttpd running phpinfo
Cherokee with PHP
apt-get install mysql-server mysql-client
apt-get install cherokee
apt-get install php5-cgi
test that cherokee runs, point your browser to http://<ip-number>
screenshot of cherokee
Screenshot of cherokee just after installing
Run cherokee-admin -b
The -b option makes it possible to reach cherokee-admin from other machines than localhost.
screenshot of cherokee admin
Screenshot of cherokee admin
Click on Virtual servers
Click on « default »
Click on « Wizzards »
Click on « Languages »
Click on « Run Wizzard » next to the PHP logo
(See screenshot below)
screenshot of cherokee admin ready to invoke php wizzard
Screenshot of cherokee admin ready to invoke the PHP-wizzard
PHP ready to use
Your server should be ready to use PHP now. To test it, create a file info.php in /var/www. The contents of the file should be something like this:
<?
phpinfo();
?>
screenshot of cherokee running php info
Screenshot of cherokee running phpinfo