Question

Im using Virtualmin on top of Webmin to configure my websites on a VPS.

Everything worked fine, but now I try to create a new domain, but when I put files in its public_html it gives the php-files to download instead of executing it. How to solve this

These is my apache config (can't find anything strange):

/etc/apache2/sites-available/testbyc.--.nu.conf

SuexecUserGroup "#1009" "#1011"
ServerName testbyc.--.nu
ServerAlias www.testbyc.--.nu
ServerAlias webmail.--.--.nu
ServerAlias admin.testbyc.--.nu
DocumentRoot /home/byc/domains/testbyc.--.nu/public_html
ErrorLog /var/log/virtualmin/testbyc.--.nu_error_log
CustomLog /var/log/virtualmin/testbyc.--.nu_access_log combined
ScriptAlias /cgi-bin/ /home/byc/domains/testbyc.--.nu/cgi-bin/
ScriptAlias /awstats/ /home/byc/domains/testbyc.--.nu/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/byc/domains/testbyc.--.nu/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/byc/domains/testbyc.--.nu/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/byc/domains/testbyc.--.nu/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/byc/domains/testbyc.--.nu/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.testbyc.--.nu
RewriteRule ^(.*) https://testbyc.--.nu:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.testbyc.--.nu
RewriteRule ^(.*) https://testbyc.--.nu:10000/ [R]
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "testbyc.--.nu statistics"
AuthType Basic
AuthUserFile /home/byc/domains/testbyc.--.nu/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/\.]*)(.cgi)?(.*) https://testbyc.--.nu:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
RedirectMatch /mailman/([^/\.]*)(.cgi)?(.*) https://testbyc.--.nu:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
Alias /pipermail /var/lib/mailman/archives/public
Was it helpful?

Solution

Try commenting out the line

php_admin_value engine Off

It's related to a larger issue that I'm still researching, but a recent update to Virtualmin added that line to some FCGI-related config files, breaking some things for some users.

OTHER TIPS

As the accepted answer has said comment out

php_admin_value engine Off

We had this issue moving a site from one Virtualmin Install with PHP 5.X to a new server with PHP 7.1.

What had happened is that the default configuration for PHP7.1 had the following

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
    php_admin_flag engine Off
</Directory>
</IfModule>

This stopped virtualmin from running PHP scripts in users directories by adding that flag to all the local .conf files.

The php7.conf file /etc/apache2/mods-available/php7.conf also had the following

SetHandler application/x-httpd-php

This was causing all child sites to run with the process www-data and not the virtualmin user. Causing write access errors. So comment that out also.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top