PHP is one of the most popular open source scripting languages that is especially suited for web development and can be embedded into HTML. In this tutorial, we will be installing PHP5 and using Apache server to serve your PHP website.
Apache package is available on Ubuntu apt-get package manager. Run the following commands to install Apache.
sudo apt-get update sudo apt-get upgrade sudo apt-get install apache2
We can now install PHP and Apache library required for PHP by using the following commands:
sudo apt-get install php5 sudo apt-get install libapache2-mod-php5
Now we have to restart Apache to load PHP. We can restart Apache by running the command below.
sudo service apache2 restart
Now you can place your website files in
/var/www/html/ directory and start accessing your website.