[SOLVED] PHP pages downloading rather than executing


I’m currently running Virtualmin on a dedicated server running CentOS 7.9 and have had a strange issue over the last couple of days so I turned to the Virtualmin forums to see if anyone could be of any assistance. Over the last 2 days php stopped executing .php files and instead started downloading them in my web browsers, this never happened in the 1.5 years of using virtualmin so it caught me off guard and did some digging to see if this had happened to anyone else.

I found some threads on various forums including virtualmin mostly pointing out that I should check my apache config httpd.conf for a specific line php_admin_value engine Off and comment it out or change my script execution mode from what is it by default FCGId to something like **FPM ** (Which does work but I’d rather find a better solution).

My question really is that I’ve never had to-do any of this before and it seems like an update in virtualmin or php has caused this kind of bug, my steps to reproducing it are quite simple since I’ve been reinstalling virtualmin and centos on VPS machines to see if I can continue getting the same problem.

  1. Get a VPS running centos 7
  2. Update yum
  3. Install virtualmin and configure
  4. Add a domain
  5. Update the pre-installed php-5 to something newer like 7.4 or 8.0 with some extensions like intl, zip
  6. Make a random .php file with anything in it.
  7. Access that domain and php file like (https://domain.com/hello.php)
  8. Downloads to my browser


What execution mode are you using with PHP? Also how are you upgrading PHP?

Best Regards,
Peter Knowles | TPN Solutions

By default I used FCGId as a I never needed to change it. I’m upgrading PHP by just following install guides like this one. How to Install PHP 7.3 in CentOS 7

Well I’ve managed to fix it, I’ll leave my solution below for anyone else who gets this and wants a fix, including myself in the future :stuck_out_tongue:

Turns out googling how to install php for CentOS and following them guides seems to be incorrect. I instead followed this guide Multiple PHP Versions | Virtualmin and installed the modules I actually needed. Thanks @tpnsolutions for offering the help anyway.



Good to hear!

Best Regards,
Peter Knowles | TPN Solutions

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.