Solved

cgi error

Posted on 2014-02-07
30
451 Views
Last Modified: 2014-03-19
After a restart of server 2003 I get the following error:

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.

None of my CGI applications are working
I am using fast cgi

Any ideas please
0
Comment
Question by:doctorbill
  • 14
  • 8
  • 8
30 Comments
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39843421
Have you checked to see if the Perl and PHP interpreters are set up in IIS?  It was working before the restart?  Can you show us simple examples of scripts that are not working?  

I have a number of Perl scripts that used to give me that message that I had to fix.  They at least have to return a "Content-type: text/html" header before the content.
0
 

Author Comment

by:doctorbill
ID: 39843834
everything was fine before the restart now all scripts are giving me this error so it must be a problem from a common source
0
 

Author Comment

by:doctorbill
ID: 39843841
This is my config set up in IIS:

Home directory tab - Configuration:
C:\Perl\bin\perl.exe "%s" %s
0
 

Author Comment

by:doctorbill
ID: 39843864
I am pretty sure there is a conflict between the perl  interpreter and some other service
Do you have any ideas please
0
 

Author Comment

by:doctorbill
ID: 39843985
Can you please tell me how the perl / cgi actually works on a web page to help me solve this issue
0
 

Author Comment

by:doctorbill
ID: 39844094
The cgi application I am using is c:\php\php-cgi.exe
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844267
I have Perl setup the same way you do except I'm on XP with IIS 5.1 and I'm using PHP thru the 'PHP5isapi.dll' module.  As far as I know, there is no interaction between Perl cgi and PHP cgi in IIS.  Although 'cgi' is used to refer to both, they are completely separate and 'fast cgi' refers only to PHP.  I've never seen that error message for PHP, only for Perl.
0
 

Author Comment

by:doctorbill
ID: 39844273
Sorry - to clarify:
The program I am using for the .php extension is c:\php\php-cgi.exe
NONE of my php sites are working
They ALL give the above CGI error

I have restarted IIS many times, started the server with all services except microsoft dissabled etc - no improvement
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844292
Where are you seeing that error?
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844314
0
 

Author Comment

by:doctorbill
ID: 39844316
In every page which has the php extension

More info:
About your previous comment:

If I use the following url:
http://localhost/cgi-bin/helloworld.pl

I get the correct response:

Hello World!

You have reached http://localhost

Your IP Address is 127.0.0.1

Have a nice day!

Why is the .php extension trying to start perl or giving a perl error ?
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844326
The error message you're receiving is a standard http error.  It's not specific to perl or php.  It simply means that the script did not output any http headers.

Either php is not configured correctly or IIS is not configured correctly to run php fast cgi scripts.

BTW, fast cgi is also available for perl, it's not just php.

Based on the output you received from http://localhost/cgi-bin/helloworld.pl, it's clear that your perl cgi scripts are working correctly.
0
 

Author Comment

by:doctorbill
ID: 39844330
Any ideas what is happening with php ?
0
 

Author Comment

by:doctorbill
ID: 39844357
If I use the following (same server system but using apache server)  it works fine:
http://localhost:888/ticktockreminders/reminder_list.php

If I use the follwing (using same server system but IIS):
http://localhost/ticktockreminders/reminder_list.php

I get the cgi error

Looks like it is IIS specific
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844361
I prefer to use perl and apache and I haven't used IIS since 2000 and have limited experience with php, so my help here may be limited.

Have you checked the error logs for both php and IIS to see if they give more details?

Are you able to run standard php scripts via php.exe instead of php-cgi.exe?

Do you get any error messages when you run php -i from the command line?

I'm not sure but php-cgi may take the same option parameter, so give it a try from the command line to see if you get any errors.

Post any/all output you receive from those commands; it may help us to help you.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844368
On my system that has both IIS and Apache, I can not run them both on the same IP address although I have never tried running them both on 'localhost'.  And when I run them on their own separate IP addresses, they do not respond to 'localhost'.
0
 

Author Comment

by:doctorbill
ID: 39844375
If I use the command prompt:

c:\php\php-cgi.exe c:\inetpub\wwwroot\phpinfo.php

The output works fine and I get all the php nformation
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844402
Running it on the command line does not involve either web server.  Also... IIS and Apache require two different versions of PHP.  IIS requires the NTS Non-Thread Safe version and Apache requires the TS Thread Safe version.  If you have only one version of PHP then either Apache or IIS is going to have a problem.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844413
Here's the download page for PHP for Windows: http://windows.php.net/download/  If you are using an older version, there is a link at the bottom of the left column for the Archive page.
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844439
On my system that has both IIS and Apache, I can not run them both on the same IP address
Dave, as long as they are listening on separate ports, you'll be able to run them simultaneously and with the same IP.  You just need to specify the port in the url if it's not listening on port 80.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844456
You're right.  IIS does hog port 80 no matter what other IP address you might want to use.
0
 

Author Comment

by:doctorbill
ID: 39844466
Recap:

1. There is nothing wrong with the PHP installation  and IIS /  Apache installs on the same server - they have been working fine together on this server for years
 
2. it looks as if it is SPECIFIC TO IIS

any ideas please
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844469
If it's been working for years and just started to fail, then you need to ask yourself (and others that may have access to the server) what recent changes have been made to the server.

Was PHP upgraded or its config altered?

Was IIS upgraded or its config altered?

Were any OS updates/patches applied?
0
 

Author Comment

by:doctorbill
ID: 39844477
No alterations at all on the system

Also:
http://localhost/phpinfo.php

This works then doesn't work and gives the error

Random behaviour
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844481
That tell me that there's probably a conflict in the config and runs somtimes under php-cgi.exe and sometimes under php.exe and one of those is misconfigured causing it to fail.
0
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 249 total points
ID: 39844484
If I were managing the server, I'd switch everything over to Apache, especially since it's already been confirmed that it is correctly running both perl and php scripts.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 251 total points
ID: 39844498
Good luck.  I'm out.
0
 

Author Comment

by:doctorbill
ID: 39844540
If I switch to apache Is it possible to run iis webapps such as sharepoint undrr apache
0
 
LVL 28

Accepted Solution

by:
FishMonger earned 249 total points
ID: 39844550
I've never used sharepoint, so I can't give a definitive answer.  But as long as it doesn't depend on any IIS specific features and adheres to the http/html standards, then I don't see any reason why it wouldn't work under apache.
0
 

Author Closing Comment

by:doctorbill
ID: 39939297
not solved but food for thought
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now