Installing PHP5

If you wish to add server-side scripting to your Pi, you're going to need PHP. You can download and install it by following the steps below. First, download and install the package:

sudo apt-get install php5

This will take 1-2 minutes to complete and you will need to answer Y when prompted to install the software. Once the installation is complete, you need to restart your Pi:

sudo reboot

When the Pi restarts, you need to check that PHP is running. You can do this by creating a webpage that includes a call to phpinfo() which will show the various settings. Use nano to create a file called phpinfo.php and then connect to it through the Pi's web server:

sudo nano /var/www/phpinfo.php

Enter the text as shown here:

<?php

  phpinfo();

?>

Save the file and go to another computer's browser and connect to http://<your-external-IP-address>:<8080>/phpinfo.php and you should see a table of information similar to this.

PHP Info table