SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict adam2003w's Avatar
    Join Date
    Mar 2004
    Location
    colorado
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random PHP FastCGI / Connection reset by peer / incomplete headers

    I've been having random 500 Internal Server errors on my PHP / MySQL based sites on various shared hosts. I'm using PHP 5.2.17 through CGI/FastCGI on a shared Linus server. When I look in the logs, I see this:

    Code:
    [error] [client 75.71.176.224] (104)Connection reset by peer: FastCGI: comm with server "/dev/shm/blackmou-php.fcgi" aborted: read failed, referer: ...
    [error] [client 75.71.176.224] FastCGI: incomplete headers (0 bytes) received from server "/dev/shm/blackmou-php.fcgi", referer: ...
    [error] [client 75.71.176.224] (104)Connection reset by peer: FastCGI: comm with server "/dev/shm/blackmou-php.fcgi" aborted: read failed, referer: ...
    [error] [client 75.71.176.224] FastCGI: incomplete headers (0 bytes) received from server "/dev/shm/blackmou-php.fcgi", referer: ...
    Anyone know how to resolve this?

  2. #2
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,301
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    a stab in the dark: Do you have any exit()s in any of your code?

  3. #3
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,301
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Addict adam2003w's Avatar
    Join Date
    Mar 2004
    Location
    colorado
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the response. I'm using "exit()" only a couple times across thousands of lines of code and use "die()" mainly in relation to testing (which I then comment out), or for failing on a mysql connection such as...

    Code:
    mysql_select_db($database_pdb_conn, $pdb_conn);
    $ResultUpdate1 = mysql_query($insertUpdateSQL, $pdb_conn) or die(mysql_error());
    Any other ideas?

  5. #5
    SitePoint Addict adam2003w's Avatar
    Join Date
    Mar 2004
    Location
    colorado
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone have any other ideas?

  6. #6
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,389
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hi Adam,

    A quick google search suggests that the errors might be caused by a DB connection problem. It's probably worth double-checking the connection details for the DB server with your hosting company, to make sure that the hostname and port are being set correctly etc.

  7. #7
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was fighting this error that popped up sporatically. Basically, it can occur when your CGI script (in my case PHP) does not return a complete set of headers (ie. script crashes or executes an exit() or die() function). I was able to track this by changing PHP (modifying php.ini) to log all errors/warnings to a file (see error_log and log_errors PHP ini settings).

    The specific issue (and why it occurred randomly for me) was that PHP was running out of memory. I had to up the "memory_limit" option in my php.ini file, and everything worked without issue. The key was logging the error though first so I knew what was causing PHP to crash.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •