Ubuntu Install PHP

Install PHP in Ubuntu 20.04 by running the commands below.

sudo apt update
sudo apt upgrade -y
sudo apt install php libapache2-mod-php -y

Add a simple php file to test if PHP was successfully installed. Create a file name info.php.

sudo -u www-data vim info.php

Paste the content below into the file.


If PHP was successfully installed, you should see a page similar to this below with your web browser.