sKunKbad Posted June 26, 2011 Share Posted June 26, 2011 Didn't know where to ask this, so thought I ask here. My cron works: 0 * * * * wget "http://mysite.com/test-cron.php" but I get an email from the server that makes it sound like I'm not doing something right: Resolving mysite.com... 123.45.678.90 Connecting to mysite.com|123.45.678.90|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 0 [text/html] test-cron.php: Permission denied Cannot write to `test-cron.php' (Permission denied). I know I can turn off the email by using >/dev/null 2>&1, but I'm just wondering if I did something wrong, and that's why it says it can't write to the file, and permission denied. I don't care about writing to the file, I just want to run the php so it sends me an email. Also, I'm using wget because the file must be accessed via http for it to work. Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/ Share on other sites More sharing options...
gristoi Posted June 26, 2011 Share Posted June 26, 2011 permissions? try making the file chmod to 0777 Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1234914 Share on other sites More sharing options...
sKunKbad Posted June 26, 2011 Author Share Posted June 26, 2011 permissions? try making the file chmod to 0777 But I don't want to write to the file, only read, which it seems to be doing, because the script on it does run. I tried looking at wget config options to see if I could figure it out, but haven't done any testing yet because I haven't had time. Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1235004 Share on other sites More sharing options...
gristoi Posted June 26, 2011 Share Posted June 26, 2011 You need to ensure that the server allows the execution of wget. A lot of servers by default have the ability to run this command disabled . Ensure it's configured correctly. It looks like it's not the file that's having a permission issue, it looks like the servers denying the wget command itself Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1235014 Share on other sites More sharing options...
Daniel0 Posted June 26, 2011 Share Posted June 26, 2011 0 * * * * wget "http://mysite.com/test-cron.php" -O /dev/null If it's on the same server, just run it directly though: 0 * * * * php /path/to/test-cron.php Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1235040 Share on other sites More sharing options...
sKunKbad Posted June 27, 2011 Author Share Posted June 27, 2011 If it's on the same server, just run it directly though: 0 * * * * php /path/to/test-cron.php The problem with that is that it's not an independent script. It's actually a controller/method in a CodeIgniter installation, and can't be accessed directly. Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1235218 Share on other sites More sharing options...
Daniel0 Posted June 27, 2011 Share Posted June 27, 2011 Right. Then just save the file to /dev/null Quote Link to comment https://forums.phpfreaks.com/topic/240421-using-wget-and-cron/#findComment-1235266 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.