Question:
apache/linux question?
Dudeberry
2007-07-09 10:06:33 UTC
Hi, I'm getting the crappy 'premature end of script headers' when I try to run a basic print_env.pl script.

I have perl installed (its on debian) The script works fine when I run it through the shell. But when I try through the webserver(apache) it doesnt want to run. The 'add-handler cgi-script .cgi .pl' is in httpd.conf. When I check the error log it says:
"(2)No such file or directory: exec of xxxx failed
Premature end of script headers: xxxx"

where xxxx is my script. clearly the script is there becuase it works from the shell. I dont have any ScriptAlias which could be preventing it from working....

any ideas anyone :-(
Four answers:
martinthurn
2007-07-09 13:24:53 UTC
Read the Idiot's Guide (link below) and then get back to us...
2007-07-09 10:18:38 UTC
All I can offer is general advice. I've had similar gremlins because I didn't have Permissions set on folders or executables. Or, the usergroups Permission. And that was the reason for "No such file or directory" even tho the idiot thing was right there. (Apache is one of those things I mean to get back to). Hope this helps.
John K
2007-07-09 10:16:13 UTC
May be these are dumb to ask, but:



* you are putting these in /cgi-bin/ ??? And calling on your server as such??? (http://whatever/cgi-bin/perl_script.pl)

* What about permissions? Coming through your browser it would be executing as apache, not whatever you are logged in as.
iammisc
2007-07-09 10:22:56 UTC
give the file complete permissions(including execute access) and make it owned by root and then try it. Also, make sure that it is in the cgi-bin.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...