Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-20-2004, 11:06 PM   #1
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:

!/usr/bin/perl -w
require "";

&ReadParse (*input);


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>';

this is my error log entry when i have it run through the web:

print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ line 10
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ line 11
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ line 13
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ line 15
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ line 16
print() on closed filehandle INFO at /usr/local/apache/cgi-bin/ 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

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, 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 Port 80
can anybody help?

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

Rep: Reputation: 55
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, 05:49 PM   #3
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> 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, 06:07 AM   #4
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,589

Rep: Reputation: 145Reputation: 145
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.


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 supermyself Programming 13 09-10-2007 07:22 AM
Perl cgi Script can`t make file.Why? ZairSadiqov Linux - Software 1 11-22-2006 08:22 AM
perl cgi neil Programming 3 07-07-2004 05:52 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 09:09 PM
Perl Script Reading a txt file and generate html to be published! kofi Linux - Software 1 09-22-2003 06:12 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:14 PM.

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