PHP 5.2.11 IIS6 502 "Bad Gateway" CGI Misbehaved incomplete headers

PHP 5.2.11 (cgi)

PHP is running fine for files operating within IIS's default website. However when a new site is defined with a host header value (such as a subdomain), php doesn't run and IIS returns 502 bad gateway or CGI has misbehaved with an incomplete set of headers error.

The new site is defined exactly the same way as the default site, with the exception that it has it's own application pool and a host header value. What couldbe causing this misconfiguration?
LVL 19
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Are you using .htaccess files,
check ur database configuration
v2MediaAuthor Commented:
@insoftservice: Q'n specifies IIS - not apache, so htaccess doesn't apply. No db connection, nor any code relates to the empty headers. A simple phpinfo() will generate the 502. If you would also care to re-read the question, you'll see that php works fine if a custom host header isn't used. You'll also see that php is configured as cgi, not fastcgi. Please dont give me any more copy-n-paste results from google; I need more than that.

Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

v2MediaAuthor Commented:
For anyone with expert IIS+CGI knowledge, IIS is configured to host multiple sites correctly. IIS will serve plain html files correctly for the new site, and 502 for anything php. However if I access the site's php files via a url from doc_root, it works fine!

i.e works fine.

New site is mapped in IIS to the above folder 'public_html' with a custom host header ''. works -> 502 bad gateway.

v2MediaAuthor Commented:
More info. I had M$ fastcgi for IIS installed for a previous php 5.3 install. When I changed the script mappings from using php-cgi.exe to the fcgiext.dll, php behaved without incident even for custom host header sites. If I don't get a solution for running php as cgi with custom host headers, I stick with the M$ fastcgi workaround.
v2MediaAuthor Commented:
OK - the word from M$ support is that the fastcgi module for IIS only has basic compatibility with IIS6. Their advice, upgrade to win2k8 and IIS7 - $TYPICAL$.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.