Robbert van Andel schreef:
I am having trouble with a PHP CLI script I wrote to help manage my website.
The site is on a shared hosting server where the PHP installation is set up
as a CGI. The script creates some backups of my databases and sends them to
Amazon's S3 service.
First off, the script runs great from the command line when I type "php5
backup.php" but when I type ./backup.php I get an error: "bash:
./backup.php: No such file or directory".
is the script marked as executable?
I thought maybe this is a problem
with the top declaration in the script "#!/usr/local/bin/php5". The problem
is that it appears the server has several php5s I can reference
/usr/local/apache/share/cgi-bin/php5
/usr/local/bin/php5
to determine which php5 you are using type:
$> which php5
this gives you the full path, which you will need to use in the relevant
cron line (and/or the shebang line at the top of the script) - cron requires fullpaths.
But it doesn't matter which one I put at the top of the script, I get the
same error.
Okay, so I can live with having to type "php5 backup.php". However, when I
try to make a cron job from the script, the script never runs. The crontab
entry looks like this
1 0 * * 2 php5
/kunden/homepages/23/d117947228/htdocs/oregonswimming/administration/backup/
backup.php > backup.log
I know the backup never runs because I redirect the output to a file and
have an email sent to me upon conclusion of the script. The log file
doesn't show anything nor do I ever receive an email. My web host will not
provide any support for scripting, so I'm hoping someone here can help.
Questions:
* How do I determine what to put at the top of the script so that I can just
call "backup.php"?
* What, if anything, do I need to do to make the script work from cron?
I've seen some comments on the web regarding PHP CLI when PHP is a CGI, but
none of them seem to apply to me.
Thank you in advance for your help.
Robbert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php