PHP is not working on Ubuntu Apache server

while you are in ubuntu 17.04

you can follow this steps

sudo apt-get install apache2 php libapache2-mod-php7.0 mysql-server php-mbstring php7.0-mbstring phpmyadmin     //install
sudo service apache2 restart    //restart

and give it another try for your file(index.php)


Check the below configuration in your web server

sudo apt-get install apache2 php5 libapache2-mod-php5`

It will install everything you need and will start the apache server with support for PHP.

To verify that the php module is loaded, type:

   a2query -m php5

if not enabled, then load with:

   sudo a2enmod php5

and restart apache:

   sudo service apache2 restart

Trying this command actually worked for me

sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc

Tags:

Php

Apache

Ubuntu