#### Archived

This topic is now archived and is closed to further replies.

# PERL help

This topic is 5234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

alright...i know this is not game related but i need some help concerning perl basically i''m trying to get my perl script to post some text to and html file, when i access it from command line, it works, but when i have it executed through the web it doesnt work (i''m running slackware 9.1, kernel 2.6.4, apache, 1.3.29) this is my code:
#!/usr/bin/perl -w
#
require "cgi-lib.pl";

$file=''/usr/local/apache/htdocs/index.html''; open(INFO, ">>$file");

print INFO ''<table cellspacing="1" cellpadding="5" border="0" bgcolor="#000000"
print INFO ''<tr bgcolor="#EEEEEE" ><td height="130" width="100" align="center"

print INFO ''<td rowspan="2" width="870"  valign="top" >'';
$sFormInput =$input{''TextPost''};

##### Share on other sites
Does your cgi process have the proper permissions to open /usr/local/apache/htdocs/index.html?

##### Share on other sites
this is my error message...

Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, root@P100Server.mtmc.phub.net.cable.rogers.com 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.Apache/1.3.29 Server at P100Server.mydomain.org Port 80

how do i set permision?

##### Share on other sites
That is not the error message related to the script, it''s an error message related to the fact that webserver failed to execute the script properly. Check the server log file for the error messasge from the script itself.

And permissions are set by chmod. Check the man pages.

##### Share on other sites
chmod can be used to give global, user or group permissions to write to the file. You can use chown to change the user or group associated with the file.

##### Share on other sites
er....i''m still a bit of a linux newb

i tried chmod +x index.html
i even tried (under /usr/local/apache) chmod 755 htdocs

no change in the error message

##### Share on other sites
Check who''s the owner of the file you''re trying to write to. If it''s not "www" (assuming that''s the user the web server is running as), and that file does not have write permissions, the web server is not allowed to open the file for writing.

As I said, check the web servers error log to see what the error message from the script is. If it says something about permission denied, then I fairly sure this is what''s wrong.

And also, the script must output a content type header before anything else is outputted. That is what "premature end of script headers" is about.
print "content-type: text/html\n\n";

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631758
• Total Posts
3002137
×