I have installed apache2-server, php5, and mysql-server. In my browser when I type localhost it shows the default apache2 page.
I also made a main.php file in /var/www/html. Then when I type localhost/main.php it executes and shows the main.php file's content in the browser and sometimes it fails. I don't understand what the issue?
I always run sudo service apache2 restart but it doesn't solve the issue.
I am using Ubuntu 14.04 and firefox 58.0.2.
Output of -
$a2query -m php5
php5 (enabled by maintainer script)

a2query -m php5to your post, then. – muru Feb 23 '18 at 06:34main.php, likephpinfo ();. – nobody Feb 23 '18 at 08:37echo "This is php";and I saw the outputThis is phpis previous time, but not now. my main.php `This is heading
` – alhelal Feb 23 '18 at 09:02}. Maybe that is why, it does not work. Take a look at error log of you apache server. There should be information about errors in PHP files. – nobody Feb 23 '18 at 13:20