13) Install PHP

<-- Previous    Next –>

This page describes how to install the latest version of the PHP language onto a Raspberry Pi

The PHP language needs to be installed on the server so we can do programming and run applications like WordPress.

Install PHP package using:

sudo apt-get install php -y

This will install the latest version of PHP.

Test PHP

At the root of your web site you need to create a file called index.php to do a test.

This will be at /websites/www/ assuming that you are using a USB drive as described in a previous page. Otherwise the root will be located at /var/www/html/

In the terminal, change directory to /websites/www/ or /var/www/html/ and then enter:

sudo nano index.php

Add some content:


echo (“First web page”);

echo( phpinfo() );


and then in the web browser load up the index.php page using http://hostname/index.php where hostname is the name of your host.

<-- Previous    Next –>