Hi all,
We installed a fresh version of Virtualmin during a server rebuild with PHP 5.6 and 7.4 running in FPM mode but when we load any of the sites, it’s dumping PHP code to the browser instead of outputting it. I know it’s been asked a tonne of times before but none of the suggestions seem to work.
- We dont have mod_php installed (we had but deleted it)
- We tried commenting out the only setHandler we could find in httpd.conf virtualhost configs for port 80 & 443 and restarted httpd but this just disabled PHP completely:
<FilesMatch \.php$>
# SetHandler proxy:unix:/var/php-fpm/1611699179171206.sock|fcgi://127.0.0.1
</FilesMatch>
Nothing works. Is there anything else we could try? What did we do wrong to cause this? It seems to happen a lot with VirtualMin so would be good to know how to avoid it in future.
UPDATE: I’ve narrowed down the issue. It’s actually PHP includes only which are dumping code to the browser. The initial PHP script executes normally until it hits an include.
SYSTEM INFORMATION | |
---|---|
OS type and version | CENTOS 8 Stream |
Webmin version | 2.021 |
Virtualmin version | 7.7 |
Here is the virtualhost config:
SuexecUserGroup "#1099" "#1069"
ServerName example.com
ServerAlias www.example.com
ServerAlias mail.example.com
ServerAlias webmail.example.com
ServerAlias admin.example.com
DocumentRoot /home/s99/public_html
ErrorLog /var/log/virtualmin/example.com_error_log
CustomLog /var/log/virtualmin/example.com_access_log combined
ScriptAlias /cgi-bin /home/s99/public_html/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/s99/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
<Directory /home/s99/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.example.com
RewriteRule ^(?!/.well-known)(.*) https://example.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.example.com
RewriteRule ^(?!/.well-known)(.*) https://example.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.4
RemoveHandler .php5.6
RemoveHandler .php7.2
<FilesMatch \.php$>
SetHandler proxy:unix:/var/php-fpm/161174295444693.sock|fcgi://127.0.0.1
</FilesMatch>