Virtualmin PRO and fcgid problem

16 posts / 0 new
Last post
#1 Fri, 02/27/2009 - 01:09
alessice

Virtualmin PRO and fcgid problem

Hi,

on a server with CentOS 5 and Virtualmin PRO only one single Virtual Server have this problem:

500 Internal Server Error on all .php pages, also with a simple phpinfo();

Virtual Server is using FCGID and php5

in logs/error_log I can see:

[Thu Feb 26 20:05:56 2009] [warn] mod_fcgid: can't apply process slot for /home/xxx/public_html/index.php [Thu Feb 26 20:06:17 2009] [warn] mod_fcgid: can't apply process slot for /home/xxx/public_html/index.php [Thu Feb 26 20:06:31 2009] [warn] (22)Invalid argument: mod_fcgid: can't release pipe mutex [Thu Feb 26 20:06:32 2009] [emerg] mod_fcgid: server is restarted, 23638 must exit [Thu Feb 26 20:06:32 2009] [emerg] mod_fcgid: server is restarted, 23613 must exit [Thu Feb 26 20:06:32 2009] [emerg] mod_fcgid: server is restarted, 22075 must exit [Thu Feb 26 20:06:37 2009] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error. [Thu Feb 26 20:06:37 2009] [error] [client 88.74.5.102] Premature end of script headers: index.php, referer: http://www.freebird-reisen.de/php/reise.php?rei [Thu Feb 26 20:06:41 2009] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error. [Thu Feb 26 20:06:41 2009] [error] [client 87.3.216.172] Premature end of script headers: index.php [...]

I think that the owner of the virtual server have made some changes via FTP, but how can now solve this problem?

Thanks

Fri, 02/27/2009 - 08:49
andreychek

Poking around Google, it sounds like a couple of things could be causing that.

What I see is that it could point to a filesystem permissions issue, or that something may be preventing mod_fcgid from spawning a new process for your domain.

So a few questions then:

* Do you see any errors in the Apache error_log when you restart Apache?

* Do any errors show up in your suexec log in /var/log/httpd?

* What does /etc/httpd/conf.d/fcgid.conf look like? Do the files mentioned in it exist?

That should give us a good start!
-Eric

Fri, 02/27/2009 - 09:26
Joe
Joe's picture

This is actually almost certainly a syntax error in the PHP. This bit is what makes me think so:

[Thu Feb 26 20:06:41 2009] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Thu Feb 26 20:06:41 2009] [error] [client 87.3.216.172] Premature end of script headers: index.php
[...]

There might be other problems...but there's definitely a problem with the app.

So, be sure the file runs from the command line and produces valid HTML (with headers).

--

Check out the forum guidelines!

Tue, 03/03/2009 - 06:18 (Reply to #3)
alessice

Thanks, but I don't think that could be a syntax error in a simple:

<? phpinfo(); ?>

[root@virtualmin ~]# cat /etc/httpd/conf.d/fcgid.conf
# This is the Apache server configuration file for providing FastCGI support
# through mod_fcgid
#
# Documentation is available at http://fastcgi.coremail.cn/doc.htm

LoadModule fcgid_module modules/mod_fcgid.so

# Use FastCGI to process .fcg .fcgi & .fpl scripts
# Don't do this if mod_fastcgi is present, as it will try to do the same thing
<IfModule !mod_fastcgi.c>
AddHandler fcgid-script fcg fcgi fpl
</IfModule>

# Sane place to put sockets and shared memory file
SocketPath run/mod_fcgid
SharememPath run/fcgid_shm

Now I have update CentOS and Virtualmin via yum, tonight i will restart the server and tomorrow We will see i the problem persist.

For now the web-site with problem (only one) was swithced to "mod_php" and works fine.

Bye

Tue, 03/03/2009 - 07:27 (Reply to #4)
alessice

After the update of the whole system the problem is the same, only one this virtual server have problem with fcgid. When i enable this in error_log:

[Tue Mar 03 18:19:13 2009] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Tue Mar 03 18:19:13 2009] [error] [client 151.80.8.220] Premature end of script headers: index.php, referer: http://www.xxxx.it/toscana/camping-norcenni-girasole-club/dove-siamo
[Tue Mar 03 18:19:15 2009] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Tue Mar 03 18:19:15 2009] [error] [client 82.50.79.12] Premature end of script headers: index.php

But the same happens with "phpinfo();"

Could be a problem of the virtualhost:

[root@virtualmin1 public_html]# cat /etc/httpd/vhost/XXXX.it.conf
<VirtualHost 10.0.0.43:80>
ServerName XXXX.it
ServerAlias www.XXXX.it
DocumentRoot /home/XXXX/public_html
ErrorLog "|/etc/webmin/virtual-server/writelogs.pl 121880779622593 /home/XXXX/logs/error_log"
CustomLog "|/etc/webmin/virtual-server/writelogs.pl 121880779622593 /home/XXXX/logs/access_log" combined
ScriptAlias /cgi-bin/ /home/XXXX/cgi-bin/
ScriptAlias /awstats /home/XXXX/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/XXXX/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php4
AddHandler fcgid-script .php5
FCGIWrapper /home/XXXX/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/XXXX/fcgi-bin/php4.fcgi .php4
FCGIWrapper /home/XXXX/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/XXXX/cgi-bin>
allow from all
</Directory>
SuexecUserGroup "#538" "#539"
<Files awstats.pl>
AuthName "XXXX.it statistics"
AuthType Basic
AuthUserFile /home/XXXX/.awstats-htpasswd
require valid-user
</Files>
FileETag INode MTime Size
RemoveHandler .php
RemoveHandler .php4
RemoveHandler .php5
</VirtualHost>

?
Thanks

Tue, 03/03/2009 - 09:13 (Reply to #5)
Joe
Joe's picture

Check the suexec log (in /var/log/httpd/suexec_log or /var/log/apache2/suexec.log), and check to be sure "suexec -V" is showing a docroot of /home.

--

Check out the forum guidelines!

Thu, 11/04/2010 - 11:20 (Reply to #6)
yngens

I've run onto this problem today. I have lots of error lines on error-log like this one:

[Thu Nov 04 08:45:04 2010] [warn] [client xxx.xxx.xxx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

/var/log/httpd/suexec.log shows fcgi error for every website on my server:

[2010-10-31 05:07:41]: uid: (511/website1) gid: (511/511) cmd: php5.fcgi
[2010-10-31 05:14:23]: uid: (512/website2) gid: (512/512) cmd: php5.fcgi
[2010-10-31 06:20:15]: uid: (508/website3) gid: (508/508) cmd: php5.fcgi
[2010-10-31 06:31:41]: uid: (504/website4) gid: (504/504) cmd: php5.fcgi
[2010-10-31 06:56:48]: uid: (516/website5) gid: (516/516) cmd: php5.fcgi

suexec -V gives:

-D AP_DOC_ROOT="/home"
-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"

How could I fix it, as this apparently causing Internal Server Error error on some of the webpages?

Thu, 11/04/2010 - 11:49
yngens

How can I temporarily transfer a virtualserver to cgi or php_mode from fcgi via Virtualmin?

Thu, 11/04/2010 - 11:52
andreychek

You can move a Virtual Server over to CGI by going into Server Configuration -> Website Options, and setting the "Script Execution Mode" to "CGI Wrapper".

-Eric

Thu, 11/04/2010 - 13:47 (Reply to #9)
yngens

Thanks Eric. I did switch to CGI, but unfortunately my Drupal installation CGI adds 'cgi-bin' into the path and naturally breaks it: http://mysite.com/cgi-bin/admin/build And this is new Drupal 6 installation with default .htaccess file, so usually it works with most of server configurations. As for server conf, I have fressh installed CentOS5 and fresh installed Virtualmin. Did not change any settings for fcgi or cgi manually. So where the problem might be?

Thu, 11/04/2010 - 11:59
ronald
ronald's picture

you can check the php.ini for the domain to have
cgi.fix_pathinfo=0

default is set to 1 and may cause issues with some scripts.

To switch, select the domain in virtualmin, go to Server Configuration - Website Options and select "PHP script execution mode Apache mod_php (run as Apache's user)" in the right pane.

Thu, 11/04/2010 - 13:49 (Reply to #11)
yngens

ronald, my /etc/php.ini does not have cgi.fix_pathinfo at all. is it a problem?

Thu, 11/04/2010 - 14:23 (Reply to #12)
andreychek

ronald, my /etc/php.ini does not have cgi.fix_pathinfo at all. is it a problem?

That all depends on your PHP version :-)

I'd recommend doing what Ronald suggested, and seeing if that indeed fixes your issue. I suspect it might!

-Eric

Thu, 02/03/2011 - 07:03
yiorgos

I had almost the same problem today after installing and using livezilla.

(104)Connection reset by peer: mod_fcgid: read data from fastcgi server error Premature end of script headers: index.php

I am running on my own virtual server. I followed ronald's instructions:

"" you can check the php.ini for the domain to have cgi.fix_pathinfo=0

default is set to 1 and may cause issues with some scripts.

To switch, select the domain in virtualmin, go to Server Configuration - Website Options and select "PHP script execution mode Apache mod_php (run as Apache's user)" in the right pane. ""

and the corrections were made. Before setting to this mode i had:

Run CGI scripts as domain owner? x Yes No

o PHP script execution mode Apache mod_php (run as Apache's user)

o CGI wrapper (run as virtual server owner)

x FCGId (run as virtual server owner)

now i have : (where x is the tick)

Run CGI scripts as domain owner? x Yes No

x PHP script execution mod Apache mod_php (run as Apache's user)

o CGI wrapper (run as virtual server owner)

o FCGId (run as virtual server owner)

At the time i think the problem is SOLVED. I wonder though if i must return back to FCGId??? hmmmm, just tried it. Yes i can! But dont do it!!! Dont' even try it!!!! Because the same 500 error occurs and you cannot visit your website. Stick to the above solution!!!!

Thank you all including the guy ho had the issue first for the help!!!!!!!!!

Sun, 03/06/2011 - 04:40
Hal9000

same problem here. plus, i am using mpm_worker, so no mod_php alternative. what can i do? i have two domains with the same problem. the strange thing is, they worked for a couple of hours, now they do not anymore... not even if i restart apache!

Sun, 03/06/2011 - 04:53
Hal9000

ok, running virtualmin modify-web --all-domains --no-php-children fixed the problem for me

Topic locked