Default sub server template uses mod_php instead of fcgid

I had posted about this in the forum a while back. I just noticed it again today. When creating top level servers the default is fcgid for PHP. but when creating sub servers the default is mod_php. I have seen this happen on multiple installs. All on CentOS 6, both architectures.

Status: 
Active

Comments

Does the sub-server template perhaps have a different setting for the default PHP execution mode?

You can see this at System Settings -> Server Templates.

Yes, the default is mod_php, this is on a completely clean install, every single time. The only setting that was changed besides the initial setup wizard was setting "Include domain name in usernames?" from "Always" to "Only to avoid a clash".

That is very unusual. Does the file /etc/webmin/virtual-server/templates/1 exist on your system, and if so what does it contain?

Yes, the time stamp is exactly when the initial setup wizard was ran. I also checked a few other systems and they are the exact same way.

Here is the contents of the file:

autoconfig=none
resources=none
dns_spf=none
domalias=none
for_users=1
user_aliases=none
skel=none
mailboxlimit=none
php5fcgi=none
disabled_web=none
defmquota=51200
name=Settings For Sub-Servers
ushell=none
avail=dns=1 mail=1 web=1 webalizer=1 mysql=1 postgres=1 spam=1 file=1 passwd=1 proc=2 cron=1 at=1 telnet=1 updown=0 change-user=1 htaccess-htpasswd=1 mailboxes=1 custom=0 shell=0 webminlog=0 syslog=1 phpini=1
php_vars=+memory_limit=32M
web_stats_pass=1
web_webmin_ssl=0
dnssec_alg=
web_ssi_suffix=
mail_on=none
othergroups=none
nodbname=0
dns_sub=yes
webmin_group=
mysql_chgrp=1
for_sub=1
spamtrap=none
ugroup=none
aliascopy=1
web_php_ini_4=
web_php_suexec=2
dnssec=none
mysql_charset=
norename=
dns_replace=
mail_subject=Virtual server created
web_sslport=443
domslimit=0
extra_prefix=none
id=1
mysql_conns=none
dbslimit=none
web_ssi=2
mysql_mkdb=1
spamclear=none
web_suexec=1
quota=1048576
status=none
namedconf_no_allow_transfer=
web_php_ini_5.5=
ranges=none
ftp_dir=
mail_bcc=
namedconf=none
logrotate=none
mysql_uconns=none
created=1392164651
mysql=${PREFIX}
web_html_perms=750
dom_aliases=postmaster=${EMAILTO}       webmaster=${EMAILTO}    abuse=${EMAILTO}        hostmaster=${EMAILTO}
mailgroup=none
hashpass=0
web_writelogs=
uquota=1048576
sgroup=none
web_admin=0
php4cgi=none
dns_view=
hashtypes=*
web_stats_noedit=1
domalias_type=0
mysql_nouser=0
web_port=80
ranges6=none
safeunder=
mongrelslimit=4
outlook_autoconfig=none
web_webmail=0
append_style=0
logrotate_files=none
disabled_url=none
frame=
web=ServerName ${DOM}   ServerAlias www.${DOM}  DocumentRoot ${HOME}/public_html        ErrorLog /var/log/virtualmin/${DOM}_error_log   CustomLog /var/log/virtualmin/${DOM}_access_log combined        ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/       DirectoryIndex index.html index.htm index.php index.php4 index.php5     <Directory ${HOME}/public_html> Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch  allow from all  AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch    </Directory>    <Directory ${HOME}/cgi-bin>     allow from all  AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch       </Directory>
web_phpver=5
featurelimits=none
resellers=*
web_php_ini_5.4=
mysql_collate=
quotatype=hard
mysql_nopass=0
php5cgi=none
mail_cc=
dns=
standard=1
web_ruby_suexec=-1
dns_prins=1
mysql_suffix=none
capabilities=none
ftpgroup=none
dns_ns=
forceunder=0
dns_master=none
php4fcgi=none
web_php_ini_5=
bwlimit=none
dom_aliases_bounce=0
web_usermin_ssl=0
dbgroup=none
bccto=none
web_php_ini_5.3=
for_parent=0
ftp=ServerName ${DOM}   <Anonymous ${HOME}/ftp> User ftp        Group ftp       UserAlias anonymous ftp <Limit WRITE>   DenyAll </Limit>        RequireValidShell off   ExtendedLog ${HOME}/logs/ftp.log        </Anonymous>
owners=*
aliaslimit=none
web_php_noedit=0
mail=
ipfollow=
web_alias=1
for_alias=0
dns_ttl=
dns_records=
postgres_encoding=none
mysql_hosts=none
mysql_wild=
dnssec_single=
webalizer=none
namedconf_no_also_notify=
web_phpchildren=
file=/etc/webmin/virtual-server/templates/1

That actually looks fine - the line web_php_suexec=2 should enable use of mod_fcgid.

Do the sub-servers you are creating have home directories?

They don't have any users, they are websites only stored under the domains directory of the parent server. I checked the actions log, I changed the template after I discovered all of my subservers were using mod_php. Here is the same file from a server that is unmodified.

I was looking at the wrong server when I mentioned the timestamp, this one shows the initial setup was done at at "16/Dec/2013 20:58" and the timestamp is "Dec 16 20:58".

This system has only one top level site, so there was no reason to look at the subserver template.

autoconfig=none
resources=none
web_html_dir=
dns_spf=none
domalias=none
for_users=1
user_aliases=none
skel=none
mailboxlimit=none
php5fcgi=none
disabled_web=none
defmquota=51200
name=Settings For Sub-Servers
ushell=none
avail=dns=1 mail=1 web=1 webalizer=1 mysql=1 postgres=1 spam=1 file=1 passwd=1 proc=2 cron=1 at=1 telnet=1 updown=0 change-user=1 htaccess-htpasswd=1 mailboxes=1 custom=0 shell=0 webminlog=0 syslog=1 phpini=1
php_vars=+memory_limit=32M
web_stats_pass=1
web_webmin_ssl=
dnssec_alg=
web_ssi_suffix=
mail_on=none
othergroups=none
nodbname=0
dns_sub=yes
webmin_group=
mysql_chgrp=1
for_sub=1
spamtrap=none
ugroup=none
aliascopy=1
web_php_ini_4=
web_php_suexec=0
dnssec=none
mysql_charset=
norename=
dns_replace=
mail_subject=Virtual server created
web_sslport=443
domslimit=0
extra_prefix=none
id=1
mysql_conns=none
dbslimit=none
web_ssi=2
mysql_mkdb=1
spamclear=none
web_stats_hdir=
web_suexec=1
quota=1048576
status=none
namedconf_no_allow_transfer=
web_php_ini_5.5=
ranges=none
ftp_dir=
mail_bcc=
namedconf=none
logrotate=none
mysql_uconns=none
created=1387245489
mysql=${PREFIX}
web_html_perms=750
dom_aliases=postmaster=${EMAILTO}       webmaster=${EMAILTO}    abuse=${EMAILTO} hostmaster=${EMAILTO}
web_stats_dir=
mailgroup=none
hashpass=0
web_writelogs=
web_webmaildom=
uquota=1048576
sgroup=none
web_admin=1
php4cgi=none
dns_view=
hashtypes=*
web_stats_noedit=1
domalias_type=0
mysql_nouser=0
web_port=80
ranges6=none
safeunder=
web_user=
mongrelslimit=4
outlook_autoconfig=none
web_webmail=1
append_style=0
logrotate_files=none
disabled_url=none
frame=
web=ServerName ${DOM}   ServerAlias www.${DOM}  DocumentRoot ${HOME}/public_html ErrorLog /var/log/virtualmin/${DOM}_error_log    CustomLog /var/log/virtualmin/${DOM}_access_log combined  ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/  DirectoryIndex index.html index.htm index.php index.php4 index.php5       <Directory ${HOME}/public_html>   Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch  allow from all  AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch   </Directory>    <Directory ${HOME}/cgi-bin>     allow from all  AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch   </Directory>
web_phpver=
featurelimits=none
resellers=*
web_admindom=
web_php_ini_5.4=
mysql_collate=
quotatype=hard
mysql_nopass=0
php5cgi=none
mail_cc=
dns=
standard=1
web_ruby_suexec=-1
dns_prins=1
mysql_suffix=none
capabilities=none
ftpgroup=none
dns_ns=
forceunder=0
dns_master=none
php4fcgi=none
web_php_ini_5=
bwlimit=none
dom_aliases_bounce=0
web_usermin_ssl=
dbgroup=none
bccto=none
web_php_ini_5.3=
for_parent=0
ftp=ServerName ${DOM}   <Anonymous ${HOME}/ftp> User ftp        Group ftp       UserAlias anonymous ftp   <Limit WRITE>   DenyAll </Limit>        RequireValidShell off     ExtendedLog ${HOME}/logs/ftp.log        </Anonymous>
owners=*
aliaslimit=none
web_php_noedit=0
mail=
ipfollow=
web_alias=1
for_alias=0
dns_ttl=
dns_records=
postgres_encoding=none
mysql_hosts=none
mysql_wild=
dnssec_single=
webalizer=none
namedconf_no_also_notify=
web_phpchildren=

Ok, that file is clearly incorrect - it has web_php_suexec=0 which forces mod_php mode.

So is the timestamp on that file when you installed Virtualmin, or when you ran the wizard?

Also, did you restore any backups (such as of global settings) after installation?

The quick fix for your current problem is to just delete the file /etc/webmin/virtual-server/templates/1 which will force the template back to its default settings.

I ran the post install script shortly after, this was in the action log with the same timestamp "Ran post-install script". Nothing was restored, a new site was created, a single top level server.

There is no mention of any template changes or restorations in the action log. I have seen this exact same thing happen many many times. I don't encounter it much because nobody uses subservers very much.

When you say you ran the post-install script, what command did you run exactly? The regular Virtualmin install script should run everything you need.

I don't know exactly what "Ran post-install script" means, but it seems to show up in the action log whenever the virtual-server module is updated.

Here is basically what I am doing, and it happens every single time.

Create server with CentOS minimal
Run install.sh
Login to Virtualmin
Change setting "Include domain name in usernames?" from "Always" to "Only to avoid a clash".
Create virtual server
look at subserver template, it wants to use mod_php

Ok, I see how - the "Ran post-install script" action is internal to Virtualmin.

Did you happen to notice if the subserver template was incorrect before creating the first virtual server?

I just did clean install on a test system. I installed VM using the install script, logged in and went to server templates -> subserver and apache is set to use mod_php.

Something in the installation process is creating a subserver template, here is a screenshot of the window.

No settings were changed Nothing was restored No sites were created Initial setup wizard has not been ran yet

Virtualmin was installed into the CentOS x86 minimal template provided by the OpenVZ team, using the install script. I have also seen this happen on physical installations using the CentOS minimal ISO.

The sub-server template will always exist. However, after a fresh install it should inherit everything from the "default settings" template.

If you click on it after doing a new install and then select the "Apache website" category, is the PHP execution mode set wrong?

Yes, it is set to mod_php, something in the install script or related packages is doing this.

Can you try running the following commands for me - I'd like to see if manually running the post-install script re-creates the template.

rm /etc/webmin/server-manager/templates/1
cd /usr/libexec/webmin
WEBMIN_CONFIG=/etc/webmin WEBMIN_VAR=/var/webmin /usr/libexec/webmin/run-postinstalls.pl virtual-server

and then check the template again.

[root@test ~]# rm /etc/webmin/virtual-server/templates/1
[root@test ~]# cd /usr/libexec/webmin
[root@test webmin]# WEBMIN_CONFIG=/etc/webmin
[root@test webmin]# WEBMIN_VAR=/var/webmin
[root@test webmin]# /usr/libexec/webmin/run-postinstalls.pl virtual-server
WEBMIN_CONFIG not set at web-lib-funcs.pl line 4156.
[root@test webmin]# echo $WEBMIN_CONFIG
/etc/webmin

I updated this test system, and it showed "Ran post-install script" in the action log, the file was no recreated.

You need to change the lines to :

export WEBMIN_CONFIG=/etc/webmin
export WEBMIN_VAR=/var/webmin

Ok, I think I've nailed this down. A fix will be included in the next Virtualmin release.

Thanks for your persistence!

Awesome! Glad I could be of some help.

So deleting "/etc/webmin/virtual-server/templates/1" will reset the subserver template back to inherit from the main template? (for any affected systems)

Hello both of you,

I was about to post a similar issue.

I'm runing Virtualmin GPL on Debian 7 servers and I noticed that most of the options of the Sub-Servers template are not set on default values anymore. That has been happening on every fresh install since a few months, presumably since the 4.03 version (unsure about that).

I'm glad that it has been reported and that it will be fixed in the next release, thank you :)