Sophie Swett
Sophie Swett

Reputation: 3390

"Premature end of script headers" with mod_fcgid and PHP

I'm trying to install Wordpress on Windows 7. I'm using Wordpress 3.9.2, Apache 2.2.25 (httpd-2.2.25-win32-x86-openssl-0.9.8y.msi), PHP 5.5.16 (php-5.5.16-Win32-VC11-x86.zip), and mod_fcgid 2.3.6 (mod_fcgid-2.3.6-win32-x86.zip).

Here are the Apache settings I'm trying to use:

LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PHPRC "C:/php"
AddHandler fcgid-script .php
FcgidWrapper "C:/php/php-cgi.exe" .php

When I try to visit any page, I get a 500 Internal Server Error, with error.log entries such as these:

[Thu Aug 21 13:45:45 2014] [warn] [client 127.0.0.1] (OS 109)The pipe has been ended.  : mod_fcgid: get overlap result error, referer: http://localhost:8080/wordpress/readme.html
[Thu Aug 21 13:45:45 2014] [error] [client 127.0.0.1] Premature end of script headers: install.php, referer: http://localhost:8080/wordpress/readme.html
[Thu Aug 21 14:05:05 2014] [warn] [client 127.0.0.1] (OS 109)The pipe has been ended.  : mod_fcgid: get overlap result error
[Thu Aug 21 14:05:05 2014] [error] [client 127.0.0.1] Premature end of script headers: test.php

I notice that the PHP files in the Wordpress distribution appear to use LF line endings instead of CRLF. However, test.php is a tiny file I created in Notepad, which therefore must be using CRLF endings instead of LF. Therefore, the line endings don't seem to be the problem.

Upvotes: 1

Views: 5729

Answers (1)

Sophie Swett
Sophie Swett

Reputation: 3390

Well, it works now, and I don't know how I fixed it.

Here's what I remember happening. test.php was giving me the above 500 error. I tried running php.exe in the Windows command line, and I also uncommented the error_log line in php.ini. (Both of these actions revealed the apparently unrelated warning "PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\php_mysqli.dll' - The specified module could not be found.") Then I tried visiting test.php again, and it worked.

Upvotes: 2

Related Questions