Unable to get PHP scripts working on a new installation (PHP scripts get downloaded as-is)

Operating system Ubuntu Linux 18.04.1
Webmin version 1.891
Usermin version 1.741
Virtualmin version 6.03

Having a terrible experience getting virtualmin working right from the box. I installed it on an Ubuntu 18.04 LTS on a linode machine.

A static page and image shows up fine for a website, but PHP scripts are downloading with their code visible plainly.

I tried this command from: https://www.virtualmin.com/comment/771219#comment-771219

a2dismod php7.2

and restarted, but nothing changed so I enabled the module back…

I’ve not installed phpMyAdmin, anything else, etc. I see many threads where people are confused about the same thing, but no DEFINITIVE answer from the VirtualMin/WebMin folks!


I looked at this of course: https://www.virtualmin.com/documentation/system/faq#toc-why-does-php--proftpd-no-longer-work-after-performing-up-YKrdup_S

But the instructions are for CentOS, not Ubuntu - nevertheless I edited two of the php conf files and restarted apache2 but to no avail!

root@li857-31:~# nano /etc/apache2/mods-available/php7.2.conf
root@li857-31:~# nano /etc/apache2/conf-available/php7.2-cgi.conf

Just completely stuck on this issue!

See previous forum post https://www.virtualmin.com/node/41507 for extra help.

is virtualmin working on Ubuntu 18.04 now? Last time i tried (a couple of weeks ago) it was a no go!

I just tried it on xubuntu 18.04.1 last night… seemed to be working…


Same issue here, fresh Virtualmin install, Digital Ocean, Ubuntu 18.04.
Created new Server and uploaded some files, only plain HTML works, PHP files open a DOWNLOAD dialog.
I’ve been hours testing different things without success, would appreciate your help.


I am having the same problem on Ubuntu 16.04. This is a fresh Digital Ocean install.
The only unusual is that I first installed Webmin and then Virtualmin.

Did you search for the offending “SetHandler” lines?

grep -ir --include *.conf SetHandler /etc

What do you get? Here’s my output (from working fresh Debian 9 install):

/etc/apache2/mods-available/proxy_balancer.conf # SetHandler balancer-manager
/etc/apache2/mods-available/status.conf SetHandler server-status
/etc/apache2/mods-available/ldap.conf SetHandler ldap-status
/etc/apache2/mods-available/php7.0.conf # SetHandler application/x-httpd-php
/etc/apache2/mods-available/php7.0.conf # SetHandler application/x-httpd-php-source
/etc/apache2/mods-available/info.conf SetHandler server-info
/etc/apache2/conf-available/php7.0-cgi.conf SetHandler application/x-httpd-php
/etc/apache2/conf-available/php7.0-cgi.conf SetHandler application/x-httpd-php-source
/etc/apache2/conf-available/php7.0-fpm.conf SetHandler “proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost”
/etc/apache2/conf-available/localized-error-pages.conf # SetHandler directive in a context somewhere. Adding
/etc/apache2/conf-available/localized-error-pages.conf # SetHandler none

Hi Jim,
I ran your command and got the following list. It lists the same entries as your list. Only the order is different, it concerns a different php version and there is a semicolon after each entry. I have no idea how to interpret it.

/etc/apache2/mods-available/proxy_balancer.conf: # SetHandler balancer-manager /etc/apache2/mods-available/ldap.conf: SetHandler ldap-status /etc/apache2/mods-available/php7.2.conf: SetHandler application/x-httpd-php /etc/apache2/mods-available/php7.2.conf: SetHandler application/x-httpd-php-source /etc/apache2/mods-available/info.conf: SetHandler server-info /etc/apache2/mods-available/status.conf: SetHandler server-status /etc/apache2/conf-available/localized-error-pages.conf:# SetHandler directive in a context somewhere. Adding /etc/apache2/conf-available/localized-error-pages.conf:# SetHandler none /etc/apache2/conf-available/php7.2-fpm.conf: SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost" /etc/apache2/conf-available/php7.2-cgi.conf: SetHandler application/x-httpd-php /etc/apache2/conf-available/php7.2-cgi.conf: SetHandler application/x-httpd-php-source

@musicmouse, you need to enclose output in “code” tags, like this:


So it’s readable. Just re-edit your post and add the tags.

You need to get rid of all of those extraneous SetHandlers for PHP. Personally, I always disable mod_php entirely (and use fcgid or FPM for execution of PHP applications…this makes the Apache process much smaller).

The SetHandler lines should be disabled during Virtualmin installation, but we have some remaining issues on Ubuntu 18.04. Also, any dist upgrade will cause new config files to be generated and they have to be reconfigured to disable those SetHandler entries again.

In a Virtualmin environment, PHP execution is handled on a per-domain basis. Any system-wide PHP configuration breaks that, and must be disabled.

Joe, can you help with the “disable mod_php entirely” on Debian 9? I am using FPM for all domains and would like to disable, but don’t want to break something.

Is it as easy as:

sudo apt remove libapache2-mod-php libapache2-mod-php7.0


i had this problem Ubuntu 18.04 so i did this

sudo ufw allow ‘Apache Full’

sudo systemctl status apache2

then i got this problem

AH00526: Syntax error on line 36 of /etc/apache2/sites-enabled/mydomain.com.conf

So i went to Webmin > Servers > Apache web server > global configuration > edit config files

and used the drop down to select my domain name like /etc/apache2/sites-enabled/mydomain.com.conf

and deleted php_admin_value engine Off on line 36 and i think it was line 93 as well so i deleted it there to

then everything worked great.

Thank you for your solution. It worked for me too - with some slight variations:

  • The file was /etc/apache2/sites-available/mydomain.com.conf
  • the “php_admin_value engine off” line was only at position 36