homepage Welcome to WebmasterWorld Guest from 204.236.254.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Php 5.2.5
Weird...
ahmedtheking




msg:3557810
 2:06 pm on Jan 25, 2008 (gmt 0)

Hey,

I've recently updated PHP to 5.2.5 from 5.1.2. However, I've had to revert because it seems that www.myurl.com/index.php/controller/function/var causes a CGI error.

PHP's running on IIS6 as a CGI extension.

Any ideas of what's causing this error?

 

phnord




msg:3557864
 3:25 pm on Jan 25, 2008 (gmt 0)

What is the error you receive on screen or from your log files?

ahmedtheking




msg:3557885
 3:54 pm on Jan 25, 2008 (gmt 0)

On the screen is just a CGI error because the app didn't send back the right HTTP headers. What log files should I look in?

Syslog doesn't have anything in there (unless I'm looking in the wrong place).

phnord




msg:3557923
 4:27 pm on Jan 25, 2008 (gmt 0)

Are you doing some kind of header redirect? Like header("Location: ..."); at any point in your code? If so, then it sounds like at some point all the necessary header information is not being set.

Do you get the "CGI Application Misbehaved ... didn't return the right headers" message? If so, that I believe is an IIS/CGI issue when you run too many CGI applications at the same time. Look at your CPU levels to see if it's running at full capacity at any time.

I would first output the headers and debug the code to make sure there are not any bizarre loops going on or other things that might not get the headers set correctly in the response. Then look into any other pieces of code...you might have an infinite loop going on that is causing other CGI apps to hang. If you were upgrading from PHP 4 to 5 I would say you probably are using deprecated functions/modifiers/etc, but since you are not, there's a good chance it might not be the code. But I would start there first.

It's tough to say without seeing your code and environment. Is it possible not to run PHP as CGI?

ahmedtheking




msg:3558134
 8:28 pm on Jan 25, 2008 (gmt 0)

Ok, here's an explanation of the script:

The script is a PHP site I've built on CodeIgnitor. It works perfectly fine under PHP 5.1.2, no CGI errors or anything. The CGI error only occurs when ANY PHP script is called up in the following style:

www.site.com/script.php/var/var/var

The environment is a Win 2003 server with PHP running as a CGI module under IIS6. It is possible to run PHP as an ISAPI extension and I'm going to try this next!

phnord




msg:3558155
 8:48 pm on Jan 25, 2008 (gmt 0)

You are using CodeIgnitor? Just hit up the CodeIgnitor forums and see if anyone else is having a similar problem. Sounds like it could be a probelm that others running PHP as CGI might have too.

phnord




msg:3558174
 8:59 pm on Jan 25, 2008 (gmt 0)

Sorry I can't be of more assistance, but in your code also check for any redirects that are happening incorrectly. For instance, are you calling a redirect from your controller? If so, you might also want to consider refactoring this as it breaks the MVC design pattern. The headers need to be outputted in the response before anything else. Usually with header errors, there is data before the server headers in the response. I think with Firebug you can monitor the request/response headers.

phnord




msg:3558183
 9:14 pm on Jan 25, 2008 (gmt 0)

Sorry, one last thing. I have two projects in development both running CodeIgniter and PHP 5.2.5 and have not come across this problem with CI. But I am not running PHP as a CGI ext. So if worst case scenario happens, can you do a standard install of PHP?

ahmedtheking




msg:3558219
 10:05 pm on Jan 25, 2008 (gmt 0)

Ah I fixed it. It was because PHP was running under CGI and not under ISAPI! However, AND THIS IS BIG BIG WARNING TO IIS USERS: Please please make sure that when you move from CGI to ISAPI for PHP and you have .NET web sites, make sure that if you have .NET 1 and .NET 2 web sites that you know which ones are which because once you add PHP ISAPI filter, it resets .NET version on SOME (it gives you a list and READ IT!) sites which causes them to go down!

It's all running on lovely ISAPI now! Woo.

phnord




msg:3559171
 6:15 pm on Jan 27, 2008 (gmt 0)

Nice...my favorite quote still about running PHP as CGI:

"You are doing what now?...that's suicide."

ahmedtheking




msg:3559223
 9:29 pm on Jan 27, 2008 (gmt 0)

Totally! It was a mistake I made around June 07. I read that the ISAPI extension was still unstable so I installed it as CGI. I'm glad it's all been sorted out now though.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved