SOLVED!!!
So a few hours after posting I found this recent post: https://www.virtualmin.com/node/57240
The original poster is running Ubuntu 18.04 LTS just like me and the solution offered by siwuch seems to work properly for me.
SOLUTION
In “/etc/apache2/mods-enabled/php*.conf” (replace php* with your filename, depending on the php version you’re using - in my case it was php7.2.conf) comment out the following two lines:
SetHandler application/x-httpd-php
SetHandler application/x-httpd-php-source
Restart the apache server via the following command:
sudo service apache2 restart
Now set your webstite to FCGId (Virtualmin -> Server Configuration -> Website options -> PHP script execution mode ) and it should work properly.
I’m putting the solution here, as well, just in case somebody stumbled on this topic from Google. All credit goes to siwuch who posted the fix in the topic I’ve linked to.
ORIGINAL POST
Hello,
I am a complete noob to VPS and Virtualmin, so I’d be thankful if I can rely a bit on the community wisdom :).
I’ve got a VPS from OVH and I installed Ubutnu 18.04 LTS a couple of weeks ago, and it is to be solely used for a few Wordpress websites. So, Virtualmin is pretty awesome and so far I’ve been able to get by and pass the blocks I’ve hit with fervorous googling, but this is something I’ve been banging my head against, for days.
The problem:
If the “PHP script execution mode” in “Website options” is set to FCGId, i.e. the default option, php files are downloaded instead of executed. Settings it to mod_php, fixes the problem, but then I have a permissions problem with Wordpress - can’t update or install plugins. I’ve to either set permissions of all folders to 777 (which even a noob like me knows is a big no-no) or change the ownership of everything inside the public_html folder to www-data, which I understand is the default Ubuntu user, but from what I’ve seen, this is also a security risk.
I’ve read around the web and the Virtualmin forums and have seen this issue is not as unique, but most, if of the solutions are for CentOS and not Ubuntu.
What I’ve tried:
- I’ve updated everything and kept it up to date. From what I’ve gathered, there are no 3rd party repositories added to my Ubuntu install (everything in /etc/apt/sources.list is either *.ubuntu.com or *.virtualmin.com). I did see PHP from a 3rd party repo could cause this, but to my understanding - that’s not the case here
- I’ve tried commenting out “SetHandler application/x-httpd-php” in /etc/apache2/mods-available/php7.2.conf
- I’ve used the command “virtualmin fix-domain-permissions --all-domains --subservers”
- I’ve used the command “virtualmin modify-web --mode fcgid --all-domains”
- I’ve tried a clean re-install of both Virtualmin and the server
- I’ve checked the Webserver error log file in /var/log/virtualmin/ but there was nothing there
I’m probably forgetting something but this is the info I can think of. I would be very thankful if somebody has an idea how to fix this. If I understand it correctly, FCGId is the Wordpress friendly mode of PHP script execution.
Thanks in advance.