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'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.
Thanks. Exact same issue tonight.
Many thanks, you saved hours from my life! :D
For me this issue has become a reason to stop using Vitaminic. I use Vitaminic so that I don't have to worry about how I should do all those millions of server settings. But how can I trust Vitaminic when it doesn't even get this very basic thing right?
My problem came after moving from php7.0 to php7.1 on Debian 9 (where php7.0 is still the standard package in the repo). The fix was (1) apt-get install php7.1-cgi; (2) modify files as per https://www.virtualmin.com/comment/754860#comment-754860 I do not think it is really Virtualmin at fault as my php upgrade was done outside Virtualmin. On the other hand, when you have a problem like this Virtualmin does introduce another layer of complexity. Probably all control panels do.
I just wanted to say thanks as well. This has solved my problem which was exactly the same as described above. The issue started to occur after I upgraded from Ubuntu 16.04 to 18.04 which changed the default php version from 7.0 to 7.2. Once I commented out the two lines in php7.2.conf and restarted apache, the problem was gone. cheers!
Just want to share one more solution if none of the above mentioned ways seems working.
You need to comment out (i.e. add # in front of the line so it becomes a comment)
SetHandler application/x-httpd-php
SetHandler application/x-httpd-php-source
in 2 (two) config files:-
/etc/apache2/mods-enabled/php7.2.conf (in my case is php 7.2)
/etc/apache2/apache2.conf
After that, remember to
sudo service apache2 restart
Clear your browser cache (Ctrl+Shift+Delete)
Mine was solved using the above procedures after days of debugging.
Hi,
I have the same problem but i use PHP 5.6 and i dont find "/etc/apache2/mods-enabled/php5.6.conf"
I use PHP 7.2 and php5.6 to run specific script with .
anyone can help me .
Thanks
Also check "/etc/apache2/apache2.conf"
I've tried all of this and it's still doing it. (Downloading rather than executing the php files)
Brand new install of Ubuntu Server 18.04 LTS and Virtualmin via the script.
So as a test I decided to just drop all the website files into the var/www/html folder for localhost and presto. It works. So there's something definitely wrong with Virtualmin that prevents it from working and constantly downloading the index.php rather than processing it.
Does anybody have any other ideas I can try? I've been at this for three days and gotten absolutely nowhere.
Hi all,
I've had this problem after installing PHP 7.3 on my ubuntu 16.04 and non of the above would fix it. After a few days I gave up and did the following:
Backup my sites and take a backup of my postfix and dovecot files Delete my sites From command line remove Apache2 then apt autoremove which essentially removed virtualmin lamp stack Ran the virtualmin installer again Created new sites and restored databases and home folders for each site
Voila! they now run under FCGID as before using PHP 7.3
After the "repair" Dovecot refused to start, remove everything in /run/dovecot and it stated ok
Same here, i've spent 3 days on this after doing the recommended updates Virtualmin said to do, Now ALL my sites are down, I've tried everything and every PHP file on all sites hosted want to download instead of run. I've tried everything and as siad above - THIS is why I used Virtualmin to begin with, so I dont have to deal with this. One click - UPDATE has cost me days and no help or answers. I'm just wore out.
JCBrancato
A note for anyone seeing this issue -- while it doesn't appear to occur in all cases, we have some some reports of this occurring.
The following document contains troubleshooting steps which should resolve it:
https://www.virtualmin.com/documentation/system/faq#toc-why-do-my-php-pa...