OS and server information:
I previously had php 5.3.x installed but decided to upgr
I had similar symptoms, yet another solution: in /etc/apache2/mods-enabled/php5.conf there was a helpful advice in the comment, which I followed:
# To re-enable php in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it.
I had this problem and if you actually never played with your server configuration settings, then your problem is 90% in your .htaccess file
You either modify .htaccess file LOCALLY, ore delete it (LOCALLY)
I have the same problem. Apache doesn't load php files from a certain website, just downloaded it. I read this post and the answers and I have seen I've got this line into the last place of the .htaccess file:
AddHandler x-mapp-php5.5 .php
I have commented it and everything works fine.
Thanks to all !!!
When i upgraded from PHP 7.2 to PHP 7.4, i also got same issue. Worked by doing following:-
In [domain].conf file
, commented following:
php_admin_value engine Off
And Added:
AddType application/x-httpd-php-source .phps
AddType text/html .php
Disable mod 7.2 and enable 7.4 by following:
a2dismod php7.2
a2enmod php7.4
In /etc/apache2/mods-enabled/php7.4.conf
file, comment following:
SetHandler application/x-httpd-php
php_admin_flag engine Off
PHP56
vim /etc/httpd/conf/httpd.conf
LoadModule php5_module libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
After updating PHP to 7.3, PHP scripts where run with www-data instead of $USER like before.
I needed to reinstall and activate PHP-FPM :
sudo apt-get install php-fpm
sudo a2enmod proxy_fcgi setenvif
sudo service apache2 restart
sudo a2enconf php7.3-fpm
sudo service apache2 restart
To ensure everything was ok for Virtualmin, i used the Re-Check Configuration wizard /virtual-server/check.cgi
, under Vitualmin/System Settings.
After that, Apache/PHP was downloading php files instead of running them. So i needed to edit /etc/apache2/mods-available/php7.3.conf
to comment the row SetHandler application/x-httpd-php
like below :
<FilesMatch ".+\.ph(ar|p|tml)$">
# SetHandler application/x-httpd-php
</FilesMatch>
After restarting Apache, it solved my issue, hope this help.
Take care of browser cache too.
My system :
Ubuntu 16.04.6 LTS
Webmin version 1.932
Usermin version 1.780
Virtualmin version 6.08
Apache version 2.4.41
PHP versions 7.3.12
PHP-FPM 7.3.12 Server