CGI-Scripts Path and Permissions

kruptof

Registered
Aug 16, 2006
4
0
151
i wrote some cgi scripts in perl and when i upload these scripts they don't seem to work, i tried changing the permissions and the path but nothing works.........where am i meant to put my scripts by default and what permission should the scripts have? i know there is no problem with code because i have tried and tested it before uploading it? i thank you inadvance for your replies.
 

randomuser

Well-Known Member
Jun 25, 2005
147
0
166
When you say "it doesn't work", you'll need to clarify _exactly_ what happens when you try running the cgi script. What exactly do you see when you enter the URL into your browser?
 

AnthonyCaesar

Active Member
Feb 21, 2005
32
0
156
This is a super simple cgi script that i installed and it does not work.

#!/usr/bin/perl -w
print <<EndOfHTML;
Content-type: text/html
<HTML>
<HEAD>
<TITLE> Hello World</TITLE>
</HEAD>
<BODY>
<H1> Hello</H1>
<P>This is a simple page</P>
</BODY>
</HTML>
EndOfHTML


And this is the error I got

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


I know nothing about perl or cgi just foolin with it a bit. What could be the problem
 

krava

Well-Known Member
Sep 23, 2003
149
0
166
cPanel Access Level
Root Administrator
Yes, the script doesn't work, because it tries to create the HTML header too late. Please modify your script to:
*******************
#!/usr/bin/perl -w

print "Content-type: text/html\n\n";
print <<EndOfHTML;
<HTML>
<HEAD>
<TITLE> Hello World</TITLE>
</HEAD>
<BODY>
<H1> Hello</H1>
<P>This is a simple page</P>
</BODY>
</HTML>
EndOfHTML

*******************
and it will work. Also, make sure EOL exists after the last "EndOfHTML".

Additionlly, don't forget to change the scripts access permissions to 755 and probably this page:
http://www.cgi101.com/book/ch1/text.html
will be useful for you too.
 
Last edited: