Apache2 & PHP showing blank page
Solution 1:
Try the following:
-
Install php for Apache with
sudo apt-get install libapache2-mod-php
-
Restart apache with
sudo service apache2 restart
-
Place code to the
/var/www/html/phpinfo.php
:<?php phpinfo(); ?>
-
Navigate web-browser to
http://localhost/phpinfo.php
.
These steps will help to check that PHP is working normally.
Note: this method works for Ubuntu 18.04 LTS, 20.04 LTS, 21.04 and 21.10 too.