desithugg Posted April 4, 2007 Share Posted April 4, 2007 Umm I have a cron setup using cPanel Every Minute,Every Hour,Every Day,Every Week,Every Month command: /home/pcaworld/public_html/timer.php <?php //timer.php mysql_connect("localhost", "********", "******") or die(mysql_error()); mysql_select_db("pcaworld_rpg") or die(mysql_error()); $st = rand(1,300); $query = mysql_query("update other set answer = '$st' where question = 'orb'") or die(mysql_error()); ?> Well it's just to test if the cron job thing works Also I have an email specified that the cron output is sent to and this is what i keep getting in the email /bin/sh: /home/pcaworld/public_html/timer.php: Permission denied and when i check the database nothing has changed umm is there any reason why it keeps saying that? Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/ Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Share Posted April 4, 2007 cmod it to 0755 and try: * * * * * curl http://domain.com/crons/cron.php Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220894 Share on other sites More sharing options...
desithugg Posted April 4, 2007 Author Share Posted April 4, 2007 umm no luck Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220897 Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 It needs a shabang. #!/usr/bin/php <?php mysql_connect("localhost", "********", "******") or die(mysql_error()); mysql_select_db("pcaworld_rpg") or die(mysql_error()); $st = rand(1,300); $query = mysql_query("update other set answer = '$st' where question = 'orb'") or die(mysql_error()); ?> PS; Make sure /usr/bin/php is a valid path to php. (In most cases it will be) Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220899 Share on other sites More sharing options...
desithugg Posted April 4, 2007 Author Share Posted April 4, 2007 umm yea that seemed to be the problem well i redid the command to wget -O /dev/null http://pcaworld.net/timer.php and i got the response --23:19:01-- http://pcaworld.net/timer.php => `/dev/null'Resolving pcaworld.net... 38.100.22.223Connecting to pcaworld.net|38.100.22.223|:80... connected.HTTP request sent, awaiting response... 200 OKLength: unspecified [text/html] 0K 0.00 B/s 23:19:05 (0.00 B/s) - `/dev/null' saved [0] in the email however nothing in the database seemed to be changed. I tried /usr/bin/php -q /home/pcaworld/public_html/timer.php php -q /home/pcaworld/public_html/timer.php /usr/bin/php -f /home/pcaworld/public_html/timer.php php -f /home/pcaworld/public_html/timer.php and none of those worked well i tried those and didn't get any email or anything either. Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220905 Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 however nothing in the database seemed to be changed. Your script appears to be executing, something else isn't working. You have absolutely no error handling in place, thats always a good idea when executing code against a db. Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220908 Share on other sites More sharing options...
desithugg Posted April 4, 2007 Author Share Posted April 4, 2007 umm woops lol i was looking i had it connecting to the wrong database sec i will retry it with the right database Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220909 Share on other sites More sharing options...
desithugg Posted April 4, 2007 Author Share Posted April 4, 2007 and it worked lol sorry for the trouble Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220912 Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Share Posted April 4, 2007 that could help eh? :-\ Link to comment https://forums.phpfreaks.com/topic/45493-solved-problem-with-cron/#findComment-220914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.