Title: problems running under php/fastcgi
Last modified: August 18, 2016

---

# problems running under php/fastcgi

 *  [scruby](https://wordpress.org/support/users/scruby/)
 * (@scruby)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/)
 * FastCGI is very picky about there being only one “Status” header being sent from
   apps. So, if like me you are running wordpress under php/fastcgi, you get errors
   like this:
 * [Sat Apr 01 23:30:42 2006] [error] [client 66.215.220.80] FastCGI: comm with 
   server “/var/www/fcgi-php/php” aborted: error parsing headers: duplicate header‘
   Status’
 * This behavior is discussed on php bugs:
    [http://bugs.php.net/bug.php?id=36705](http://bugs.php.net/bug.php?id=36705)
 * According to php bugs, the resolution to this problem is at the programming level.
 * In wordpress, in file /wp-includes/functions.php there is the following two lines
   of code:
 * [@header](https://wordpress.org/support/users/header/)(“Status: $header $text”);
   
   [@header](https://wordpress.org/support/users/header/)(“HTTP/1.1 $header $text”);
 * In order to make wordpress play nicely with fastcgi, I had to replace those two
   lines with the following four lines:
 * if (substr(php_sapi_name(), 0, 3) == ‘cgi’)
    [@header](https://wordpress.org/support/users/header/)(“
   Status: $header $text”); else [@header](https://wordpress.org/support/users/header/)(“
   HTTP/1.1 $header $text”);
 * I’m hoping that the wordpress developers will incorporate this change into the
   next update of wordpress.

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/page/2/?output_format=md)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-367506)
 * If you file this over at [http://trac.wordpress.org](http://trac.wordpress.org)
   that would be very helpful.
 *  Thread Starter [scruby](https://wordpress.org/support/users/scruby/)
 * (@scruby)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-367509)
 * Thanks. Opening a ticket.
 *  [dje](https://wordpress.org/support/users/dje/)
 * (@dje)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368158)
 * This solved the 404.php problem I had immediately. My server was running fastcgi
   with PHP5. I cannot believe how quickly that solved the problem that I thought
   was caused by an incorrect .htaccess file.
 * Thank you very much for this solution. Can I vote for your ticket to prioritise
   it?
 *  [sblamey](https://wordpress.org/support/users/sblamey/)
 * (@sblamey)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368161)
 * I came across this solution when trying to troubleshoot a problem with my 404
   page – whatever non-existing URL is typed, wordpress responds with index.php
 * I thought the above might help since the blog in question is hosted on a server
   running PHP under cgi and not mod_php. However, having made the change, wordpress
   still shows index.php when trying to visit a non-existing URL.
 * I set-up a test blog on some other web-space that I have that does use mod_php
   and the result is better – the apache server returns a 404 page, but not the 
   404.php in the defult template.
 * It seems that many others are having problems with 404 and there are numerous
   tips that work for some and not others. Does anyone know if this is close to 
   being nailed?
 * I am using wordpress 2.0.3 for both installations.
 *  [sblamey](https://wordpress.org/support/users/sblamey/)
 * (@sblamey)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368162)
 * I did some more work on this and added .htaccess to my test blog. Everything 
   works as expected with wordpress showing the 404.php for non-existent URLs.
 * This must be something todo with the hosting setup on my other blog, where PHP
   runs under cgi. I’ve checked that .htaccess is being used and rewriting is taking
   place.
 * Can anyone point me to another thread here as my problem does not seem related
   to the above.
 * Thanks,
    Steve.
 *  [fak3r](https://wordpress.org/support/users/fak3r/)
 * (@fak3r)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368164)
 * Steve
    Not sure if this is a similar issue or not, but I can’t get Permalinks
   running, so I’ve recompiled PHP5 w/o FastCGI support, now it just should be PHP
   running under CGI, but I can’t get Permalinks to work, or the 404 page. See if
   any of my issues appear as yours:
 * [http://wordpress.org/support/topic/76914?replies=1#post-398723](http://wordpress.org/support/topic/76914?replies=1#post-398723)
 * You’ll see that the rewriting is working, but no 404 page is ever shown, just
   the rewriten URI, which it fails to find (even though my .htaccess file is good
   and I have mod_rewrite running and working on this server)
 * Thanks
 * f
 *  [dje](https://wordpress.org/support/users/dje/)
 * (@dje)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368174)
 * I have upgraded to 2.0.4 and the above `bug` and I can see that the above fix
   has not been incorporated into the core. So I made the changes to `functions.
   php` as above and the problem was solved.
    How can we ensure the fix is incorporated?
 *  [dje](https://wordpress.org/support/users/dje/)
 * (@dje)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368179)
 * I have upgraded to 2.0.5 (from 2.0.4) and the above fix has still not been incorporated
   into the core as my error 404 page was not working after upgrade (I was just 
   getting a server error). So I made the changes to functions.php as above and 
   the problem was solved (again).
    How can we ensure the fix is incorporated into
   the next release?
 *  [ejm](https://wordpress.org/support/users/llizard/)
 * (@llizard)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368182)
 * I too just upgraded from wp2.0.4 to wp2.0.5 (with default permalink structure).
   I am in the minority of wp users who had to install the [500 server error fix plugin](http://markjaquith.wordpress.com/2006/10/28/some-wordpress-205-users-reporting-server-500-error).
   There was some mention that it might be wp run with fastcgi (have NO idea what
   fastcgi is) that experience this 500 error problem with WP2.0.5.
 * Thinking that perhaps FastCGI is what my host uses, I applied the fix to /wp-
   includes/functions.php. Some improvement: a 404 page now appears rather than 
   the page just opening to the index page of my wordpress. However, my custom wordpress
   404 page isn’t appearing; it defaults over to the 404 page for my whole site.
 * I’ve searched this forum but have not found a fix that works. Any ideas? (Please
   bear in mind that I only know enough about php coding to get me in trouble)
 * etherwork.net/blog/
 *  [hrachovec](https://wordpress.org/support/users/hrachovec/)
 * (@hrachovec)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368183)
 * Hello. I believe I may be having a similar problem as mentioned in scruby’s first
   post. However after using the suggested code tweak, there’s no improvement: I
   still get a browser error message ‘Failed to open page’ when I try to access 
   my wp-admin page. Can someone provide any suggestions or point me to another 
   post?
 * When I contacted my web host they revealed I had this problem when accessing 
   the above page:
 * The problem seems to be that a script is generating double headers, wich cause
   a 500 error:
    front05.web: [Fri Nov 10 14:07:36 2006] [error] [client 195.204.47.53]
   FastCGI: comm with server “/var/www/00/31/62/simonfanshawe.com/cgi-bin/php-fcgi-
   starter” aborted: error parsing headers: duplicate header ‘Status’
 * ..and they pointed me here. But after making scruby’s suggested change to the/
   wp-includes/functions.php file, there’s still no improvement.
 * Any feedback would be welcome.
 * PS: For what it’s worth. I reloaded all WP files on the server and the admin 
   page then worked. But as soon as I logged out, I got the same problem as stated
   above.
 *  [hrachovec](https://wordpress.org/support/users/hrachovec/)
 * (@hrachovec)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368184)
 * Oh no. I’ve spoken too soon. I got it sorted thanks to that patch listed by llizard.
   many thanks!
 *  [Ghidra99](https://wordpress.org/support/users/ghidra99/)
 * (@ghidra99)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368185)
 * scruby’s fix helped get rid of my 404 Errors. Thanks!
 *  [froggystone](https://wordpress.org/support/users/froggystone/)
 * (@froggystone)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368190)
 * Yes i can confirm that the fix works
 * In addition people who has b-one or one.com as host is gonna need this fix cause
   of the use of FastCGI
 * further more, plz implement this fix till next release 🙂
 *  [dje](https://wordpress.org/support/users/dje/)
 * (@dje)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368192)
 * Now fixed in 2.0.6
 * I have upgraded to 2.0.6 (from 2.0.5) and now I no longer have the problems mentioned
   above. In other words, whatever they have incorporated this fix into 2.0.6 and
   it now works!
 *  [ejm](https://wordpress.org/support/users/llizard/)
 * (@llizard)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/#post-368199)
 * I finally got the custom 404 page I created specifically for wordpress to display
   by adding a line to the .htaccess in the wordpress root folder:
 * `ErrorDocument 404 http://domainname/wordpress/404.shtml`
 * Why 404.shtml? Because I was getting an error message in the 404.php I created….

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/page/2/?output_format=md)

The topic ‘problems running under php/fastcgi’ is closed to new replies.

## Tags

 * [fastcgi](https://wordpress.org/support/topic-tag/fastcgi/)

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 18 replies
 * 10 participants
 * Last reply from: [cheese500](https://wordpress.org/support/users/cduke250/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/problems-running-under-phpfastcgi/page/2/#post-368203)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
