I would like to point out that the script not only needs to be
eXecutable but Readable as well (the perl interpreter needs to be able
to read the script). I believe that the safest permissions can be set
as follows:
chmod 755 script.pl
Allen, the first thing that popped into my mind after reading your post
was that Apache has to be told what to execute and what to display.
This is usually done by the file extension. If Apache doesn't realize
that files with the pattern *.pl or *.cgi should be executed, it will
probably assume that it should display the contents of the file instead
of execute it as a script returning the output to the browser. It is
also possible to tell Apache to execute scripts located in a specific
directory. If the file is not in that directory, again Apache will just
display the contents of the file. To add to the complexity of the
problem, it is also possible to combine the two methods I describe
above.
Unfortunately, the message from your brother doesn't really give much
concrete information. I would guess from that message that the cause of
the problem wasn't so much your script but the newly created httpd
daemon.
Have you considered installing a web server on your own system? Both
Apache (http://www.apache.org) and Perl (http://www.perl.com/) are free
and have been ported to a number of systems. It really doesn't take
much to set the system up for your own personal use. This list would
not be the place to ask questions specific to Apache (someplace like the
newsgroup comp.infosystems.www.servers.* could probably help). Please
correct me if I'm wrong but I do believe that newbie questions
pertaining to setting up Perl for the first time would fit in this list.
Hope this helps.
Dan
Jonathan Kerr wrote:
>
> a couple of questions:
>
> are your scripts in a cgi-bin directory?
> did you make your scripts executable? ( chmod +x filename.pl )
> is the path correct?
>
> Not all systems have perl in /usr/bin/perl. From the command line type
> % which perl
> and that will give you the path to specify in the first line of your perl
> file
> ie.
> #!/public/bin/perl -w
>
> hope that helps.
>
> Jon
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 3:13 PM
> To: [EMAIL PROTECTED]
> Subject: Perl CGI (Getting started.)
>
> Hi:
>
> I am trying to learn Perl CGI but I am having a hard time finding a server
> that I can run scripts on and then getting them to run. My brother has a
> web server and was
> going to let me log on and put some scripts into a directory and run them.
> I couldn't get them to run, I just got the text echoed back to my browser,
> some interpreted as HTML but definitely not running it. I asked him what
> was wrong and he sent me this:
>
> "I had perl running on my Linux server under apache. The problem was
> that the new httpd daemon I created thrashed the appearance of some
> other stuff I was hosting. Fortunately I had a back up."
>
> I certainly don't want to interfere with the business he's running, but it
> was exciting to have that available but now I don't have any idea how or
> where to test a Perl CGI script. I want to open "My_Script.pl" or
> "My_Script.cgi" in a browser and actually see output from a running script.
> The scripts I am starting with are very elementary examples from perl books.
>
> Any help about how to test a CGI script (or better, fix my brother's
> problem) will be greatly appreciated.
>
> Thanks,
>
> Gregg R. Allen
> 62 TW Alexander Dr
> Research Triangle Park, NC. 27709
>
> Blessed are they who expect nothing,
> for they shall not be disappointed.
>
> F. Nietzsche