My webhost has cPanel which only accepts Perl scripts, aargh So I'm using this to get Perl to call my real PHP scripts which do all the work #!/usr/local/bin/perl -w use LWP::Simple; use CGI; my $URL="[url="http://www.mysite.com/myscript.php"]http://www.mysite.com/myscript.php[/url]"; my $content = LWP::Simple::get($URL); print "$content"; Code (markup): I have 2 cron jobs, 2 Perl scripts and 2 PHP scripts. Both the PHP scripts are called using the full URL even though one is on the same server. Both PHP scripts will work if called directly. Now, one of the Perl scripts works, but the other doesn't. I get sent to me by the cron job. If I call it in the browser I get a 500 error. Line 10 is the print "$content"; statement. Any ideas why it might decide to fall over? Sarah
You can't use php? They just don't offer it? Clarification: you're calling the perl script in a cron job; right? Have you checked your perms? 500 error is a permissions error; check to make sure that if it's a perl script; perms are 755, make sure the script was uploaded in ascii mode; not binary, and don't use dreamweaver to edit the script. If the script is a php script; sometimes setting the perms to 777 does the trick. This sounds like you have funky characters in the perl script itself. YOu can't see it; but if you sshd into your box and did a vi filename you could.
Thanks for the reply. I can use PHP on the site, but I can't get the Cron to call PHP. I'm happier with PHP so I figured I'd just get the Perl script to fire up the PHP script and I can code merrily away in there. I have another server where I don't have cron and I need to get info from it, so my first perl script calls a PHP script on that server. Getting this up and running was painless. The second perl script is a copy, literally, of the first, with just the page changed. I give the full domain and page. I can run the PHP script manually, no probs. Perl scripts are set to upload as Ascii but to be sure I uploaded it again. The settings were 755, now 777, no change. I tried running the perl script on another server which I could also vi the script and there are no stray characters. It's very clean. On that server I got a 403 error, not a 500 error and I'm not sure quite what the problem was... The important thing was that there were no funky characters. This is really frustrating - because it should be so simple Sarah
If you are on a cpanel server; and want to run a cron script for php; do this. You can either log into the cron area of cpanel; or ssh. Use a path like this: GET http://yourdomainname.com/path to/file.php
Thanks for the hint flawebworks but GET just returned me my source code, it didn't RUN the code. Sarah
flawebworks you gave me just the hint I needed. Thank you! I did a hunt around and it seems that instead of GET I needed php. Took a while to find the documentation but I'm up and running, woohoo! Sarah
Instead of GET http://yourdomainname.com/path to/file.php I use this ina a cron script : lynx -dump http://yourdomainname.com/file.php >> /dev/null but You have to use lynx. Maybe is possible to use also wget but you had to study the command line options. bye
It didn't like WGET when I tried that since it's happy with PHP I'll let stay with that. It's been happily working every hour today, no problems, just a happily updating site and an unstressed server. Sarah
Some people know just how to soften me up Well... Use the script I have at the very top of this thread and get it to call your PHP script. The PHP script does all the work and will do the job if called from a regular browser. Generally they will only output debugging or verification data, in plain text, not html. The perl just calls the PHP for you and nothing else. Sarah