blankextacy Posted February 12, 2007 Share Posted February 12, 2007 ok im using cron tab 5 i guess well when ever i try to run a command it works fine but it doesnt run the file instead i get this error. /home/mitchell/public_html/cron_min/cron_minute.php: line 1: syntax error near unexpected token `(' /home/mitchell/public_html/cron_min/cron_minute.php: line 1: `<? include("config.php");' and when i used to use free cronjob services it ran the files perfectly Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/ Share on other sites More sharing options...
Yesideez Posted February 12, 2007 Share Posted February 12, 2007 Try removing the brackets: include "config.php"; Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182443 Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 can we see the actual code? Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182450 Share on other sites More sharing options...
blankextacy Posted February 12, 2007 Author Share Posted February 12, 2007 ya there it is im getting this error now /home/mitchell/public_html/cron_min/cron_minute.php: line 1: ?: No such file or directory /home/mitchell/public_html/cron_min/cron_minute.php: line 2: syntax error near unexpected token `"update turn set time_right=time_right-1"' /home/mitchell/public_html/cron_min/cron_minute.php: line 2: `mysql_query("update turn set time_right=time_right-1");' <? include "config.php"; mysql_query("update turn set time_right=time_right-1"); mysql_query("update turn set time_right=9 where time_right = -1"); mysql_query("update turn set time_left=6 where time_right = 0 and time_left = 0"); mysql_query("update turn set time_left=time_left-1 where time_right = 9"); $spell1 = mysql_query("select * from spellc"); while ($spell = mysql_fetch_array($spell1)) { mysql_query("update spellc set time=time-1 where id=$spell[id]"); mysql_query("DELETE from spellc where id=$spell[id] and time<=1"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182452 Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 For starters, if your trying to run php from the command line it needs a shebang line. eg; #!/usr/bin/php Otherwise bash won't know which program should execute the script. Second, are you sure you have short tags enabled? Use <?php instead of <?. Thirdly, that is some horrible code. There is absolutely no error handling... ever heard of an if() statement? Your code assumes that every query is successful. Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182454 Share on other sites More sharing options...
blankextacy Posted February 12, 2007 Author Share Posted February 12, 2007 im a horrible coder but shh lol Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182455 Share on other sites More sharing options...
blankextacy Posted February 12, 2007 Author Share Posted February 12, 2007 where do i put #!/usr/bin/php ? Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182456 Share on other sites More sharing options...
Yesideez Posted February 12, 2007 Share Posted February 12, 2007 The very first line of cron_minute.php although I'm checking my cron scripts to confirm. Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182458 Share on other sites More sharing options...
blankextacy Posted February 12, 2007 Author Share Posted February 12, 2007 rawrz it worked i love you all! Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182459 Share on other sites More sharing options...
Yesideez Posted February 12, 2007 Share Posted February 12, 2007 Quote Link to comment https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.