3

I'm trying to run sample Perl script on Windows 7 and I configured IIS 7 to allow ActivePerl to run but I'm getting this error:

 HTTP Error 502.2 - Bad Gateway The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Hello World. ". Module CgiModule Notification ExecuteRequestHandler Handler Perl Script (PL) Error Code 0x00000000 Requested URL http://localhost:80/hello.pl Physical Path C:\inetpub\wwwroot\hello.pl Logon Method Anonymous Logon User Anonymous 

and here is my Perl script:

#!/usr/bin/perl print "Hello World.\n"; 

2 Answers 2

8

The first output returned from any CGI program should be the headers.

Try

#!/usr/bin/perl print "Content-type: text/plain\n\n"; print "Hello World.\n"; 
Sign up to request clarification or add additional context in comments.

1 Comment

And then keep this link handy for future reference: stackoverflow.com/questions/2165022/…
-3

A related situation would be when you are getting this error while installing WordPress.

A really simple solution that helped me out of my frustrations is to simply allow permissions to the folder where your website is installed. I got this problem when I could not install WordPress project. After going round and round the web, that is what it came down to: folder permissions!

4 Comments

How is this a "related situation"? Wordpress is not using Perl at all, and the accepted answer contains a completely different solution than yours
Related because of this "HTTP Error 502.2 - Bad Gateway. The specified CGI application misbehaved..." I guess that is how I ended up in this thread. There aren't many solutions I could get that pointed me to that little fact
Please add all clarification to your answer by editing it
This is more of an edit to my answer above: I had set up a self-hosting service using Windows Server 2022. I then setup Handler Mappings and FastCGI Settings for PHP. When I installed WordPress, it loaded well with my websites. However, when I applied themes to any of the websites I was getting this error. It took me quite a while to find a solution, which was simply applying read-write permissions for the logged in users (WordPress users) to the website folders.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.