2
votes

I'm getting the below error for my WordPress website immediately after installing Virtualmin. Website was working fine before. I've repeated this several times over by restoring my VM to its previous state. I just can't work it out.

Some history. I have a new clean install of Ubuntu which I then set up using Linode's guides. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic

LAMP stack. PHP 7.2. Firewall is UFW. Website still works after the install of Webmin but as soon as I install VirtualMin I get the below. Virtualmin completes with no errors. Website still works fine ... UNTIL I reboot and then it fails.

I've retried restart Apache2. Tried re-installing apache. I've checked the PHP ini files and they seem fine. Tried re-installing PHP and restarting it.

The PHP logs also show repeated errors like "PHP Warning: fopen(): Filename cannot be empty in" I"ve attempted to re-extract a copy of the Wordpress site files and it still doesn't work.

Any suggestions?

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
1
Could be so many things that is wrong unfortunately. But it seems like it should be a configuration problem in Apache like SetHandler (not understanding PHP) - jannej
Okay can we start with working through what the "so many things are"? I checked for SetHandler and couldn't find a setting for it. Is there somewhere specific to be looking? Any other suggestions? - deancrabb
My best bet is that it's Apache 2 configuration issue if you see PHP source code. Start there. Sorry, I cannot be more specific where the issue could be. Maybe try stackoverflow.com/questions/11595830/… or techrepublic.com/article/… Good luck! - jannej
Thanks @jannej I'll check it out. - deancrabb

1 Answers

2
votes

Ah okay, I found a solution.

Took a TAR copy of the entire apache2 folder before and after the VirtualMin install. Then FTP'd the tar files down to my PC, and extracted them.

Then used some software called Beyond Compare to compare both folders for file differences. Then went through and compared the contents of each file that had changed.

Most notable was a change to the /etc/apache2/mods-available/php7.2.conf file. The 2 lines near the top defining the SetHander were commented out. I clued onto this from @jannej's comment. Removing the comments then restarting the apache server fixed the issues.

Hope this helps someone else.

    <FilesMatch ".+\.ph(ar|p|tml)$">
    #    SetHandler application/x-httpd-php    <<--- remove the comment
    </FilesMatch>
    <FilesMatch ".+\.phps$">
    #    SetHandler application/x-httpd-php-source   <<--- remove the comment
    # 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