Here's My Problem

Recently I purged all LAMP packages because I couldn't make virtual hosts work with my local wordpress installation. But then even after installing all the packages, PHP pages simply don't load. They all come out blank and if you ask to see the page source you can see php source code there.

I am attaching a list of things I have already tried and logs and configurations I think you might need. Kindly help me out and let me know if you need anything more than this to figure thigs out.

Things I have already tried:

  1. Updating all Packages
  2. Purging and Reinstalling all LAMP packages
  3. mpm_event is already disabled
  4. php module is enabled in apache modules
  5. Tried setting preferred php version
  6. libapache2_mod_php is already installed
  7. Installing php and other modules specifying the version number
  8. All PHP error reporting is turned on
  9. Adding the following code to apache2.conf which makes Apache crash in my case:
AddHandler php5-script .php
AddType text/html .php
  1. Uninstalling all packages and installing lamp with "lamp-server^" package
  2. Enabling PHP in user directories
  3. Enabling short tags in php.ini
  4. default_mimetype = "text/html" is already enabled in my php.ini

Here's my Apache Error Log

[Fri Dec 11 09:46:11.126711 2020] [mpm_prefork:notice] [pid 1447] AH00163: Apache/2.4.46 (Ubuntu) configured -- resuming normal operations
[Fri Dec 11 09:46:11.126805 2020] [core:notice] [pid 1447] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 11 10:08:32.375532 2020] [mpm_prefork:notice] [pid 1447] AH00169: caught SIGTERM, shutting down

Here's what my Apache Access Log shows for the request

::1 - - [10/Dec/2020:10:16:30 +0530] "GET /info.php HTTP/1.1" 200 224 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

Here's my PHP module mods-enabled conf:

<FilesMatch ".+\.ph(ar|p|tml)$">
    SetHandler application/x-httpd-php
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(ar|p|ps|tml)$">
    Require all denied

# Running PHP scripts in user directories is disabled by default
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
#    <Directory /home/*/public_html>
#        php_admin_flag engine Off
#    </Directory>


  • I have php 7.4 installed
  • Earlier I had mariadb server installed
  • Now I have mysql-server installed
  • Please post output of "apachectl -M" so that we can see what modules you enabled. Commented Dec 27, 2020 at 10:47
  • Thanks for trying to help Thomas. But the issue was resolved.
    – cryptic
    Commented Dec 30, 2020 at 4:56

1 Answer 1


I would look at the answer given at this question: PHP returning blank pages which boils down to "Are your permissions correct?"

According to this question: https://stackoverflow.com/questions/2096255/what-permissions-for-php-scripts-directories, "You need to set the .php file's permissions to 640 for maxiumum security."

  • Hey...thanks! It worked like a charm. Just instead of setting the permission to 640, I recurssively handed over permission 755 to the "/var/www/" directory.
    – cryptic
    Commented Dec 14, 2020 at 4:54
  • Yup! Happy to help! Commented Dec 17, 2020 at 3:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .