jeff5656 Posted July 4, 2012 Share Posted July 4, 2012 Not sure if this is the right category but it's the closest I could find. I am trying to run a cron job and I get a permission denied when the cron job is run. But in that script I have this at the top: $dbhost = "localhost"; $dbname = "mydb_name"; $dbuser = "mehere"; $dbpass = "mypassword"; mysql_connect ( $dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $curr_date=date("Y-m-d"); //delete table here $query = "select this from that where thois = that" $result=mysql_query($query) or die(mysql_error()); But when it says "permission denied" it looks like I am not even running the script? To administrator: if this belongs in another forum that is seldom-used, could you keep this here for a short while until I get an answer and then move it? :-) I am pointing to the correct directory int he cron job: /home/myname/cronjobs/runthis.php Link to comment https://forums.phpfreaks.com/topic/265197-cron-wont-run/ Share on other sites More sharing options...
trq Posted July 4, 2012 Share Posted July 4, 2012 Does this script have <?php ?> tags? Your also not telling cron to use php to execute the script. This: /home/myname/cronjobs/runthis.php Needs to be something like: /path/to/php /home/myname/cronjobs/runthis.php Link to comment https://forums.phpfreaks.com/topic/265197-cron-wont-run/#findComment-1359091 Share on other sites More sharing options...
jeff5656 Posted July 4, 2012 Author Share Posted July 4, 2012 Yes I'm using the php tags and the script runs when I run it manually. I will contact host to see what the path to php is. I'll bet that's what the problem is. Thanks! Link to comment https://forums.phpfreaks.com/topic/265197-cron-wont-run/#findComment-1359093 Share on other sites More sharing options...
jeff5656 Posted July 4, 2012 Author Share Posted July 4, 2012 solved /usr/bin/php -f Link to comment https://forums.phpfreaks.com/topic/265197-cron-wont-run/#findComment-1359101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.