Page 1 of 1

Running a perl Script

Posted: Sun Jul 13, 2003 9:15 pm
by evilmonkey
Hello. Before I start with my problem, let me point out that I have never used perl before. That's right never even ran a perl script. I'm a PHP man, but I have come to a point where I need to use Perl.

So I have a perl script, and I have no idea what to do with it. I uploaded to a directory first, ran it, got a 500 error. Uploaded it to the cgi-bin directory, 500 error. Did some reaserch ( ;) ) and chmodded it to 755. Got this error:
You must run this script from the command line.
At this point I thought that I was screwed because i don't have command-line access to the server (other than a cron job). I am on a shared hosting platform. But then I dug into the code and found this:

Code: Select all

############################################################              
# Some people try to run this as a CGI. That's wrong!
############################################################              
if ( defined( $ENV{'PATH_INFO'} )
    || defined( $ENV{'QUERY_STRING'} )
    || defined( $ENV{'REQUEST_METHOD'} ) ) {
    print "Content-Type: text/html\n\n";
    print "You must run this script from the command line.";
    exit;
    }
Well if running it as CGI is wrong, what do I do? If I need to set up a cron job, someone please tell me exactly what to put in.

If anyone is wondering, this is the SquirrelMail set-up script. Yes, I know there is a config.php file. Yes, I have edited it to fit my needs. But I still want to run this script. But how?

Thanks.

Cheers!

Posted: Sat Aug 02, 2003 8:13 pm
by jmarcv
look at exec()

Posted: Sat Aug 02, 2003 8:30 pm
by evilmonkey
What's exec()? And of what language?

Posted: Sat Aug 02, 2003 8:58 pm
by jmarcv

Posted: Sat Aug 02, 2003 9:55 pm
by evilmonkey
I don't rally understand this command. I tried:

Code: Select all

<?php
exec ("conf.pl");
?>
but that did nothing. Little more help please.

Posted: Sat Aug 02, 2003 10:01 pm
by jmarcv
Did you go to the link?
If you need to get data back, that is more complicated.
Also, if php does not have permission to execute the program, nothing will happen. It can be a tricky command to use, and not all hosting companies support it.

Posted: Sat Aug 02, 2003 10:05 pm
by evilmonkey
:( i guess I need shell access to get this thing going :(