Forum Moderators: coopster

Message Too Old, No Replies

Premature end of script headers: cgi wrapper

500 Internal server error issue with wordpress installation

         

burnthelies

5:58 am on May 21, 2011 (gmt 0)

10+ Year Member



Hi everyone,
The long and the short of my issue is i recently moved from a shared hosting environment to a VPS hosting environment. Transfer of all databases went to plan and have all our sites live on our new host. However one issue has come to light, that seems to effect all domains however the error occurs on only one.

This domain is our main focus with anywhere from 10 - 50 new pieces of content added daily (using a Wordpress installation as the backend). Recently we started to see 500 Internal Server Errors at random when adding new content, however the errors were intermittent and a lot of the time, even though the browser would show a 500 error after a couple of minutes the content would still successfully post.

When we look at the error log for the domain we see the following that is relevant:
[/code][Tue May 17 21:34:41 2011] [warn] [client ###.###.###.###] Timeout waiting for output from CGI script /var/www/cgi-bin/cgi_wrapper/cgi_wrapper, referer: http://www.our-domain.com/content/wp-admin/post-new.php
[Tue May 17 21:34:41 2011] [error] [client ###.###.###.###] Premature end of script headers: cgi_wrapper, referer: http://www.our-domain.com/content/wp-admin/post-new.php [code]


When the error occurs, it appears NONE of the PHP driven sites on our VPS will display, all sit at the 'Waiting for domain-name.com' process when we try to load them so is it possible that there is something corrupt (php.ini?) or something thats not working properly on our server side?

Have been trying to work this issue out for a few weeks now and am coming up blank so hoping somebody with some expertise can give us some advice!

Look forward to your insight.

Warm Regards,
Ewan.

coopster

3:08 pm on May 24, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, burnthelies.

I'm not certain where to start here but I would like to believe that something else is amiss on the server. For example, you mentioned that NONE of the PHP driven sites on your VPS function. Does this mean a plain old HTML page request doesn't work too?

gugus101

10:32 pm on Jun 23, 2011 (gmt 0)

10+ Year Member



I ran into a similar problem after a VPS plex upgrade. Checking the /var/log/httpd/suexec_log I found the following message:

[2011-06-23 15:07:16]: uid: (10001/gugus101) gid: (505/505) cmd: cgi_wrapper
[2011-06-23 15:07:16]: target uid/gid (10001/505 or 504) mismatch with directory (0/0) or program (10001/504)


As it turned out the script itself had the correct permission but not the directory itself "." - which belonged to root:root

# ls -la /var/www/cgi-bin/cgi_wrapper/
total 8
drwxr-xr-x 2 root root 4096 Jun 23 14:54 .
drwxr-xr-x 4 root root 4096 May 4 03:54 ..
-rwxr-xr-x 1 gugus101 psacln 32 Jun 23 14:54 cgi_wrapper
-rwxr-xr-x 1 gugus101 psacln 32 Mar 30 05:03 cgi_wrapper-dist

Changing the ownership of the cgi_wrapper directory solved the issue:

# chown gugus101:psacln /var/www/cgi-bin/cgi_wrapper


so it now looks like:

drwxr-xr-x 2 gugus101 psacln 4096 Jun 23 14:54 .
drwxr-xr-x 4 root root 4096 May 4 03:54 ..
-rwxr-xr-x 1 gugus101 psacln 32 Jun 23 14:54 cgi_wrapper
-rwxr-xr-x 1 gugus101 psacln 32 Mar 30 05:03 cgi_wrapper-dist


Since this is in the "common" configuration part of the VPS WEB server it will impact all php scripts of your site.

Hope it helps - Uli