Author |
|
Nick2015
Joined: 28 Oct 2015 Posts: 5
|
Posted: Tue 17 Nov '15 8:31 Post subject: Perl CGI output not returned to browser |
|
|
Hello Forum,
I'm trying to set up a testing environment for some perl cgi-scripts on a Win7 SP1 64 bit platform using Apache as webserver.
So far installing Apache 2.4.17 Win 32 and ActivePerl 5.16 (32 bit) worked fine. Calling localhost from a browser returns "It works!".
I installed Apache as a service as described in the installation guide. Active perl came as MSI installer.
Unfortunately I have trouble getting perl scripts work. I've been reading a lot of docs on Apache Lounge and Apache.org regarding setting up and configuration under Windows, but still no luck. So, if I enter localhost/cgi-bin/printenv.pl, I don't get any results from the script. The browser (Firefox) tells me "Waiting for localhost".
Neither there are any hints or error-messages in the error log of apache, nor are there any hints in the windows event-log.
So far I checked
- runnig script form cmd-line works fine
- correct Perl syntax
- correct shebang line
- correct settings in system environment variables (e.g. path to perl)
- correct conf settings for running cgi-scripts (ScriptAlias)
- Antivirus settings
- the advice on this site: https://www.devside.net/wamp-server/apache-startup-and-running-issues
But no luck
Using Processmonitor from Systinternals I could see that the perl script was found an executed by a httpd process, but cgi output was never delivered to the browser.
So I'd be glad, if I could get some helpful hints by forum experts of Apache Lounge.
Thanks in advance,
Nick2015 |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Tue 17 Nov '15 8:48 Post subject: |
|
|
What about
AddHandler cgi-script .cgi
It's about 2/3 of the way down httpd.conf and is usually commented out by default. You can also add .pl to the end as well to cover that extension.
AddHandler cgi-script .cgi .pl
ScriptLog logs/script-error.log
ScriptLog is also nice to have in case as it will pick up any errors from STDERR. |
|
Back to top |
|
Nick2015
Joined: 28 Oct 2015 Posts: 5
|
Posted: Tue 17 Nov '15 13:01 Post subject: |
|
|
Hello glsmith, thanks a lot for very quick response.
I tried your suggestions and uncommented/added your lines to my conf-file.
Unfortunately the problem still exists.
The ScriptLog directive has no effect on my system. I expected the mentioned logfile in the logs directory. But there wasn't any. |
|
Back to top |
|
Nick2015
Joined: 28 Oct 2015 Posts: 5
|
Posted: Sun 22 Nov '15 17:43 Post subject: |
|
|
Found an interesting Microsoft article today. Maybe, it will solve my problem.
I'm going to check and report tomorrow.
"The STDIN, the STDOUT, and the STDERR redirections do not work in a WOW64 child process if the CreateProcessWithTokenW function creates the child process "
Look at https://support.microsoft.com/en-us/kb/971163 |
|
Back to top |
|
Nick2015
Joined: 28 Oct 2015 Posts: 5
|
Posted: Wed 25 Nov '15 13:44 Post subject: |
|
|
Today, I tried the solution described in the Microsoft Article. Again, nothing but frustration.
Next step was replacing 32 bit versions of Apache and Perl by their 64 bit counterparts.
Again, the same result.
Apache says "It works" but when I run the perl test script the bowser doesn't get any http response. Instead the browser complains "Waiting for localhost".
What I definitely can observe is the following:
Calling static html files are served by the parent httpd-process. When calling a perl script it is the child process who looks for perl and runs the script.
But what the heck prevents apache to return the scrip's output?
Nobody out there who has an idea what I could do to get it work? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 25 Nov '15 19:42 Post subject: |
|
|
I have no idea but you could put it in your documentroot where the It Works page is and add ExecCGI to the Options for that directory, restart Apache and try from there.
http://localhost/printenv.pl |
|
Back to top |
|
Nick2015
Joined: 28 Oct 2015 Posts: 5
|
Posted: Tue 01 Dec '15 20:11 Post subject: |
|
|
Hi, today I found some time to have a look at my problem again.
Doing a stack trace on httpd.exe using Process Explorer from Sysinternals, I could see that Windows Kernel libraries got stuck.
So I'm wondering if outdtated windows libraries could be the problem.
What do you think? |
|
Back to top |
|
fgorji
Joined: 15 Dec 2015 Posts: 9 Location: Iran
|
Posted: Tue 22 Dec '15 16:26 Post subject: |
|
|
Look at my solutions one from last year and the other
posted this year . |
|
Back to top |
|