Ubuntu 18.04 = Virtualmin 6.0.11 : LAMP - PHP not working - download PHP code

Hello I test the new Ubuntu 18.04 with the new Virtualmin install script 6.0.11 (beta).

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 ?

Thanks Didier

Status: 
Active

Comments

Howdy -- what is the output of this command:

find /etc/apache2 -type f | xargs grep -i sethandler

find /etc/apache2 -type f | xargs grep -i sethandler

/etc/apache2/conf-available/php7.2-fpm.conf:        SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"
/etc/apache2/conf-available/php7.2-cgi.conf:    SetHandler application/x-httpd-php
/etc/apache2/conf-available/php7.2-cgi.conf:    SetHandler application/x-httpd-php-source
/etc/apache2/conf-available/localized-error-pages.conf:#   SetHandler directive in a <Location /> context somewhere. Adding
/etc/apache2/conf-available/localized-error-pages.conf:# SetHandler none
/etc/apache2/mods-available/proxy_balancer.conf: #    SetHandler balancer-manager
/etc/apache2/mods-available/ldap.conf: SetHandler ldap-status
/etc/apache2/mods-available/status.conf: SetHandler server-status
/etc/apache2/mods-available/php7.2.conf:    SetHandler application/x-httpd-php
/etc/apache2/mods-available/php7.2.conf:    SetHandler application/x-httpd-php-source
/etc/apache2/mods-available/info.conf: SetHandler server-info

================== duard find the problem (or part of the problem) :

=> comment this line on virtual hosts conf files in sites-avaiable

php_admin_value engine Off

======================= and ok, "info.php" works !

But it's a bypass. I think it can have a solution to not be oblige to manually edit the VirtualHost for each new website...

Thanks. Didier

Changing the VirtualHost blocks there isn't our recommended solution.

What I'd suggest is to edit the two config files that contain this line:

SetHandler application/x-httpd-php

Comment those lines out, and then restart Apache.

After doing that, do things work as expected?

I edit the 2 files :

/etc/apache2/conf-available/php7.2-cgi.conf /etc/apache2/mods-available/php7.2.conf

I comment the lines "SetHandler application/x-httpd-php"

service apache2 restart

I create a new website with Virtualmin

and OK, "info.php" is running !

no line with "php_admin_value engine Off" in the Virtual Host !

Thanks. Didier

Correction !

"info.php" works ! Correct.

But, the line is yet in the VirtualHost :

RemoveHandler .php RemoveHandler .php7.2 php_admin_value engine Off <---- FcgidMaxRequestLen 1073741824

strange... but ok, "info.php" is fine.

The "RemoveHandler" lines are normal, and should indeed be there.

Do things work as expected when commenting out the SetHandler lines from those two files, but leaving the "RemoveHandler" lines in place?

The "RemoveHandler" lines are normal, and should indeed be there.

Do things work as expected when commenting out the SetHandler lines from those two files, but leaving > the "RemoveHandler" lines in place?

Just commenting out the handler in file mods-available/php7.2.conf was enough.

I must test this. Thanks.. Didier