PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Coding & Tutorials (http://www.phpdig.net/forum/forumdisplay.php?f=31)
-   -   Cron problem, please help me!!!! (http://www.phpdig.net/forum/showthread.php?t=2144)

Brock 09-06-2005 08:00 PM

Cron problem, please help me!!!!
 
I'm making a cronjob for a client that will automaticly activate a php script everyday. I thought it would be easy, but I just cant get it to work.
Here's the error email I get:
/home/myname/public_html/test/test2.php: line 1: ?php: No such file or directory
/home/myname/public_html/test/test2.php: line 2: =works great: command not found
/home/myname/public_html/test/test2.php: line 3: =noreply@myemail.com: command not found
/home/myname/public_html/test/test2.php: line 4: syntax error near unexpected token `'myname@gmail.com','
/home/myname/public_html/test/test2.php: line 4: ` mail('myname@gmail.com', 'single test', $message, $from);'

Please help me, I'm new to all this and so frustrated.

Brock

Charter 09-07-2005 06:06 AM

Assuming test2.php is the PHP script you want to run, you are not passing variables, and you have *nix shell access, make a cron.txt file with the following:
Code:

0 0 * * * /full/path/to/php -f /full/path/to/test2.php > /full/path/to/log.txt
That says to run test2.php and dump any output to log.txt at midnight of every day. Then type /full/path/to/crontab /full/path/to/cron.txt to set the cronjob.

Brock 09-07-2005 05:23 PM

Awesome, that fixed it. Thanks so much!


All times are GMT -8. The time now is 10:05 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.