I really want to setup a server of virtual hosts where each website runs as it’s virtual host owner rather than as apache, mostly because this is an optimal setup for WordPress and other CMS. So after research I chose Virtualmin to help me achieve this using the FCGId method.
After setting up a virtual host, I switch the PHP Script execution mode from “Apache mod_php (run as Apache’s user)” to “FCGId (run as virtual server owner)” and my site returns “500” Internal Server Error".
Output of error logs follows:
----------------- Virtual hosts logs/error_log: --------------------
[Fri Apr 20 05:27:51 2012] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Fri Apr 20 05:27:51 2012] [error] [client 64.115.91.114] Premature end of script headers: phpinfo.php
----------------- Virtual hosts logs/error_log: --------------------
[Fri Apr 20 05:27:51 2012] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Fri Apr 20 05:27:51 2012] [error] [client 64.115.91.114] Premature end of script headers: phpinfo.php
----------------- etc/httpd/logs/error_log: --------------------
[Fri Apr 20 05:27:51 2012] [notice] mod_fcgid: call /home//public_html/phpinfo.php with wrapper /home//fcgi-bin/php5.fcgi
suexec policy violation: see suexec log for more details
----------------- etc/httpd/logs/suexec.log: --------------------
[2012-04-20 05:27:49]: uid: (505/) gid: (505/505) cmd: php5.fcgi
[2012-04-20 05:27:49]: command not in docroot (/home//fcgi-bin/php5.fcgi)
Other Important Information
Output of /usr/sbin/httpd -V
Server version: Apache/2.2.3
Server built: Oct 20 2011 17:00:12
Server’s Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with…
-D APACHE_MPM_DIR=“server/mpm/prefork”
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG=“run/httpd.pid”
-D DEFAULT_SCOREBOARD=“logs/apache_runtime_status”
-D DEFAULT_LOCKFILE=“logs/accept.lock”
-D DEFAULT_ERRORLOG=“logs/error_log”
-D AP_TYPES_CONFIG_FILE=“conf/mime.types”
-D SERVER_CONFIG_FILE=“conf/httpd.conf”
Output of php -v
PHP 5.3.10 (cli) (built: Feb 2 2012 17:34:38)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2012 Zend Technologies
with eAccelerator v0.9.6.1, Copyright © 2004-2010 eAccelerator, by eAccelerator
with the ionCube PHP Loader v4.0.14, Copyright © 2002-2011, by ionCube Ltd., and
with Xdebug v2.1.4, Copyright © 2002-2012, by Derick Rethans
Now this confused me - I found 2 instances of suexec.
/usr/sbin/suexec -V
-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=100
-D AP_HTTPD_USER=“apache”
-D AP_LOG_EXEC="/var/log/httpd/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=500
-D AP_USERDIR_SUFFIX=“public_html”
/usr/bin/suexec -V
-D AP_DOC_ROOT="/home"
-D AP_GID_MIN=100
-D AP_HTTPD_USER=“apache”
-D AP_LOG_EXEC="/usr/local/apache2/logs/suexec_log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=100
From abundant (2 days worth) of research on this, I know that AP_DOC_ROOT needs to be “/home”, from the suexec in /bin/. When I run /which suexex it replies “/usr/bin/suexec” So that appears to be correct.
I would really wish to avoid removing apache and reinstalling this server for like the fifth time… please help? Is there a way I can patch this?