Link to home
Start Free TrialLog in
Avatar of v2Media
v2MediaFlag for Australia

asked on

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

PHP 5.2.11 (cgi)
Win2K3
IIS6

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?
Avatar of Insoftservice inso
Insoftservice inso
Flag of India image

hi,

Are you using .htaccess files,
check ur database configuration
Avatar of v2Media

ASKER

@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.



Avatar of v2Media

ASKER

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

http://local.domain.com/newsite/public_html/index.php works fine.

New site is mapped in IIS to the above folder 'public_html' with a custom host header 'newsite.domain.com'.

http://newsite.domain.com/index.html works
http://newsite.domain.com/index.php -> 502 bad gateway.

Avatar of v2Media

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of v2Media
v2Media
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial