LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-20-2004, 10:06 PM   #1
the_y_man
LQ Newbie
 
Registered: Jan 2003
Posts: 13

Rep: Reputation: 0
cgi perl : I cant get perl to append my html file...


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:

Code:
!/usr/bin/perl -w
#
require "cgi-lib.pl";

&ReadParse (*input);

$file='/usr/local/apache/htdocs/index.html';

open(INFO, ">>$file") or die ("failed to open file: &!");

print INFO '<table cellspacing="1" cellpadding="5" border="0" bgcolor="#000000">';
print INFO '<TR bgcolor="#EEEEEE" ><td height="130" width="100" align="center" valign="top"> Picture goes here<br>Name</td>';

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

close(INFO);
this is my error log entry when i have it run through the web:

Code:
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 10
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 11
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 13
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 15
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 16
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/newpost.pl line 17
the perl script works fine when i execute it through the server's bash shell.

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

no change in the error message

by the way, this is the error i get through the web, when i try to execute

Code:
Internal Server Error
The 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
can anybody help?

Last edited by the_y_man; 03-20-2004 at 10:12 PM.
 
Old 03-21-2004, 03:53 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
An error message like that usually indicates:
1. A syntax error, or
2. That the file does not have execute permissions

Shouldn't that very first line be #!/usr/bin/perl not !/usr/bin/perl?
 
Old 03-21-2004, 04:49 PM   #3
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 31
> alright...i know this is not game related but

You can post any sort of GNU/Linux software development questions here, not just game programming.
 
Old 03-22-2004, 05:07 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,426

Rep: Reputation: 100Reputation: 100
the index.html should be writable for the server user so chmod 0755 would not be the soultion but
chmod 0666 index.html
but it might be related to the servers configuration in respect of execution of cgi scripts, too. do other cgi programs run on that server? apache comes with a detailed documentation on cgi issues.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl CGI:Can't locate CGI.pm supermyself Programming 13 09-10-2007 06:22 AM
Perl cgi Script can`t make file.Why? ZairSadiqov Linux - Software 1 11-22-2006 07:22 AM
perl cgi neil Programming 3 07-07-2004 04:52 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
Perl Script Reading a txt file and generate html to be published! kofi Linux - Software 1 09-22-2003 05:12 PM


All times are GMT -5. The time now is 03:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration