Using Cron with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MerlinCorey
Forum Newbie
Posts: 6
Joined: Sat Nov 02, 2002 12:35 am
Location: Los Angeles, California

Using Cron with PHP

Post by MerlinCorey »

I work for a site with a couple of online games (second link in my signature) and we've decided to use Cron to update the information... I have experience with crontab itself and I have set it up properly (meaning the dates and times to run the file); however, it generates errors when running the file (crontab emails me after each run with the results)... I simply used the location of the file as the program to run and it seems to not want to run .php ...

Basically, is there a way to set it up so that it DOES run the php file as expected or should I run it in a browser (I've just this minute set it to execute "lynx myfile.php")..? And if the browser solution is the way to go, does it automatically close lynx after the page is loaded..? This is necessary as we are hosted elsewhere and I don't believe we're allowed any background processes...

Thanks in advance, if the lynx method works, I'll post back...
MerlinCorey
Forum Newbie
Posts: 6
Joined: Sat Nov 02, 2002 12:35 am
Location: Los Angeles, California

Post by MerlinCorey »

Code: Select all

Your Terminal type is unknown! 

  Enter a terminal type: їvt100] 
TERMINAL TYPE IS SET TO vt100 
(B)0ї1;24rїmї?7hї?1h=їHїJї21Bї0;7mGetting file://localhost/home/path/to/the/fileїm 

ї24;1H ї?1l>
That's what it told me after it executed with the lynx line... :?

Apparently lynx doesn't want to run outside of a terminal... Stupid lynx... :p
Last edited by MerlinCorey on Sat Nov 02, 2002 5:42 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

topic e.g. covered at viewtopic.php?t=2480 ;)
try

Code: Select all

/usr/bin/php -f /home/buyourstuf/www/onslaught/sources/update.php
MerlinCorey
Forum Newbie
Posts: 6
Joined: Sat Nov 02, 2002 12:35 am
Location: Los Angeles, California

Post by MerlinCorey »

Thanks... We'll see in about 20 minutes... :)
MerlinCorey
Forum Newbie
Posts: 6
Joined: Sat Nov 02, 2002 12:35 am
Location: Los Angeles, California

Post by MerlinCorey »

Worked like a charm...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

i have a similar issue:

i had it working before

i used the -l command and it worked great

i recently changed directories for my game, and i want to reactivate it and disable the old entry, i went ahead and did the same command as before and its not working, anyone know what could be wrong?

thanks.
Post Reply