Website – Install Apache

Use the following to install apache:

sudo apt-get install apache2

Add the following to your samba configuration, if you want to manage the website from your desktop, and restart samba:

[www] comment = /var/www on Raspberry Pi
path = /var/www
writeable = yes
guest ok = no

sudo /etc/init.d/samba restart

Give the pi user access:

sudo chown -R pi:pi /var/www/html

Confirm that you can browse to your website    http://home-hub

and create and edit files in the html document root.

The next task is to install PHP, PEAR, MDB2 and MDB2 pgsql.

sudo apt-get install php5 libapache2-mod-php5 php-pear php5-pgsql
sudo pear install MDB2
sudo pear install pear/MDB2#pgsql

The best way to check that PHP is correctly installed is to create a small script, info.php, that runs the phpinfo() function and place it in the var/www/html directory.

<?php

 // Show all information
 phpinfo();

?>

Browse to this page and if PHP is working you will see a long list of details about the installation.

If all that checks out we can move on to testing database access from our website.