Hello
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” .
BUT
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 ?
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.
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…
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.