Apache2 & PHP showing blank page

22,651

Try the following:

  1. Install php for Apache with sudo apt-get install libapache2-mod-php

  2. Restart apache with

    sudo service apache2 restart
    
  3. Place code to the /var/www/html/phpinfo.php:

    <?php
    phpinfo();
    ?>
    
  4. 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.

Share:
22,651

Related videos on Youtube

sevku
Author by

sevku

Updated on September 18, 2022

Comments

  • sevku
    sevku over 1 year

    I've tried to install PHP and Apache2, however when I access the file, it just shows a blank page.

    I've installed the packages php, apache2, php-mysql (and some others)

    I've already tried pretty much everything that I could find on the Internet.

    I'm sorry if I'm not providing enough info, I will give any info that I can.

  • fugitive
    fugitive over 6 years
    He needs to reset apache service for modules to get loaded i believe.