[snip]I wrote a really simple 11 or 12 line PHP script to remove old entries from a web card application I made:
<?
$todays_date=DATE("Y-m-d");
Take a look at this line:
$todays_date=DATE("Y-m-d");
When it is ran from the command line this line causes the script to give these error messages:
/home/actsmin/actsministries-www/webcards/administration/daily_maintenance.p hp3: line 3: syntax error near unexpected token `DATE("' /home/actsmin/actsministries-www/webcards/administration/daily_maintenance.p hp3: line 3: `$todays_date = DATE("Y-m-d");'
Any idea why the command line can't deal with but the http:// version works just fine?
I'm guessing you're not running this through php, you've just made it executable? You need to either give it some #! magic (e.g. #!/bin/php) - or - more clearly, call php from cron and pass it this script. (In either case, <?php is better form than just <?.
00 8-19/2 * * mon-fri /usr/bin/php /foo/backup_script.php
[if you aren't suppressing output properly, you can also do this]
00 8-19/2 * * mon-fri /usr/bin/php /foo/backup_script.php > /dev/null
[though it's better to suppress output properly, so you can get any error messages/etc.]
cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php