PHP is a server-side scripting language used in mostly web development and also used to serve the dynamic content. It can run scripts to connect to Mysql database.
First we’re going to check whether PHP is installed or not
PHP is not installed on our Ubuntu machine then let’s install the required packages.
apt-get install php libapache2-mod-php php-mysql
Now PHP has been installed on Ubuntu machine with these dependencies
You can also install PHP-mcrypt package if you want And Now create a file under the directory /var/www/html/test.php
Edit these file and put these line
Save and exit
Test the PHP setup and browse with your system ip
if you get these output means php is installed properly and working.