Wordpress site shows php code after fresh install of VirtualMin

6 posts / 0 new
Last post
#1 Thu, 10/03/2019 - 08:17
deancrabb

Wordpress site shows php code after fresh install of VirtualMin

Hi,

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 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. Virtual min 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?

Cheers Dean

<?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' );
<code>
Thu, 10/03/2019 - 11:25
miklovestech

Did you go through the Virtualmin Automated Install?

I setup a LAMP on my own and had this issue.

To rectify the issue, try:

sudo nano /etc/apache2/mods-enabled/dir.conf

Edit to look like this:

DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

Then restart Apache2.

Fri, 10/04/2019 - 18:41
deancrabb

Mine looks like this DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

I changed it to look like yours but it didn't work, even after reboot.

Any other suggestions?

Mon, 10/14/2019 - 04:24
deancrabb

Anyone else have any suggestions on this? Still got the problem

Mon, 10/14/2019 - 05:18
deancrabb

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 a comment in another thread on another site. 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
Mon, 10/14/2019 - 07:00
Jfro

Not working if php-fpm ofcourse. ;)

Topic locked