Ubuntu 18.04 = Virtualmin 6.0.11 : LAMP - PHP not working - download PHP code

I test the new Ubuntu 18.04 with the new Virtualmin install script 6.0.11.

It’s a new Proxmox container (unpriviledge container).

I simply

  • install the Ubuntu 18.04
  • run Virtualmin beta 6.0.11 install script

so, Virtualmin, Webmin, Usermin, LAMP, Fail2ban, Bind9, Postfix was automaticaly installed by the script.

All seem normal.

I create a new server with Virtualmin :

A simple HTML page is correctly display “Hello Word” .


If I try a PHP page like “info.php”, the browser try to DOWNLOAD the PHP code !
So, Apache + PHP don’t run PHP, but simply send PHP code to the user …

Some day ago, I try to install Virtualmin manually with the .deb package.
And it was working !
“info.php” display all PHP informations (and not dowload the code)

So, it’s probably a bug in the Virtualmin install script ?

Perhaps a little setting missing between Apache and PHP ?


Same here. This seems a problem with FCGId (FPM appears to be working).

Same problem here.
My php sites are downloading instead of executing.

fresh install !!!

RESOLVED => comment this line on virtual hosts conf files in sites-avaiable

php_admin_value engine Off

How I don’t see this !..

info.php works.

But, it’s not really solved.
It’s a bypass and, ok we can work with Ubuntu 18.04 LTS.

How to correct this, so that we don’t need to edit the Apache VirtualHost each time we create a new site ?

Thanks. Didier

However now php does not appear to be running as the account owner.

May be related https://www.virtualmin.com/node/24245

The reason this happening is mod_php is globally enabled and it has precedence over CGI or FCGI (which allows running under account owner). If the site is configured to run as CGI or FCGI, the following line is added to apache vhost file:

php_admin_value engine Off

This disables mod_php for the site. As a result, when apache receives request it follows processing with mod_php, but then vhost config disables php with the line above, and you get the code displayed / downloaded, instead interpreted by PHP.

In order to fix, comment out the lines that globally enable mod_php in /etc/apache2/mods-enabled/php*.conf (replace * with correct version on your server). Two lines needs to be commented out, in my case this file looks as follows:

1 2 #SetHandler application/x-httpd-php <---------- this one 3 4 5 #SetHandler application/x-httpd-php-source <------------- and this one 6 # Deny access to raw php sources by default 7 # To re-enable it's recommended to enable access to the files 8 # only in specific virtual host or directory 9 Require all denied 10 11 # Deny access to files without filename (e.g. '.php') 12 13 Require all denied 14 15 16 # Running PHP scripts in user directories is disabled by default 17 # 18 # To re-enable PHP in user directories comment the following lines 19 # (from to .) Do NOT set it to On as it 20 # prevents .htaccess files from disabling it. 21 22 23 php_admin_flag engine Off 24 25

Comment out the lines, restart apache, set your site to run as domain owner in fcgid mode, that should be it.
Also keep in mind that tinkering with vhost definitions outside of Virtualmin like suggested in one of the posts above, will cause problems one day, because Virtualmin will eventually overwrite the file one day, when making config changes to the site.

Just wanted to personally thank siwuch. You helped me with something that kept me banging my head against the wall for two weeks. I cannot thank you enough.

thanks to #siwuch for your fix !

Yes thank you siwuch. I created an account simply to thank you. I’ve been trying to figure this out for days now. Much appreciated!

so this is a virt bug?

Yeah, there’s a few outstanding issues with Ubuntu 18.04 support, unfortunately. Due to that, we haven’t yet listed that as one of the supported distros. We’re working on fixing those issues though, and hope to have full support for that in the near future! But we unfortunately don’t have an ETA.

Once it’s fully supported, we’ll make a news release here in the Forums, as well as list it as a supported OS in the install script, and list it in the os-support page here on the website.


andreychek, how safe is it to install current Virtualmin / Webmin (6.04 / 1.894) on Ubuntu 18.04? I just finished installing after disabling Netplan, fixed this PHP code download issue and so far so good. I have not tested extensively, and I’m wondering what kind of issues are the ones that are left until official Ubuntu 18.04 support is added. Should I expect any issues down the road if I keep current setup? I know I’m asking about unsupported stuff, was just wondering, maybe the remaining issues are not that significant and it’s safe to keep that guy and then just upgrade to the most recent Virtualmin once it’s released, without breaking the whole thing…


You’ve gotten past the hard part. There’s actually quite a few folks now using Ubuntu 18.04, it’s mostly those issues that you’ve already fixed.

You shouldn’t be seeing “random” issues down the road… if things work now, they should work later too.

Personally, if I were in your shoes, I’d move forward with using Ubuntu 18.04 :slight_smile:

And if you do happen to run into any issues, let us know and we’ll add those to the list!


Fantastic, thanks!


I did as you suggested and my site was already set to run in fcgid mode… still downloading the file.

Thank you for sharing this! I am running on Ubuntu 16.04, and everything was fine with PHP 7.0, but I had to add 7.3 to accommodate Laravel stuff, and then all sites started downloading php files.

You saved my bacon!