Installing PHP and MySQL
PHP is one of the most popular programming languages in use today for the web look at. It is the code that runs on the server when it receives a request for a website. Unlike HTML, PHP can generate dynamic web pages that can change the look and content on the fly. We chose PHP to work with because WordPress uses PHP. Now, install PHP and the accompanying Apache packages with the following command:
$ sudo apt-get install php5 libapache2-mod-php5
We now have PHP installed with its accompanying Apache packages, and we will proceed to test it.
Navigate to the HTML folder and create a new index.php
file:
$ cd /var/www/html/ $ sudo nano index.php
Add a test line to it:
<?php echo "hello world"; ?>
Save the file and exit by pressing Ctrl + X and then Y. We also need to remove the index.html
file because HTML takes precedence over PHP. Do that with the following command:
sudo rm index.html
Navigate to 127.0.0.1
or localhost
in the browser and you will be greeted...