jazzman1 Posted October 25, 2012 Share Posted October 25, 2012 Hi friends, When I try to run the script by cron - it doesn't do anything. It works just fine running through the browser. <?php $pageName = basename($_SERVER['PHP_SELF']); file_put_contents($pageName, ''); ?> Quote Link to comment https://forums.phpfreaks.com/topic/269878-rewrite-a-string-to-a-file-with-cron/ Share on other sites More sharing options...
requinix Posted October 25, 2012 Share Posted October 25, 2012 1. Use __FILE__ instead. file_put_contents(__FILE__, ''); 2. You (the user cron is running tasks as) probably don't have write permissions on the file. That's good. Your script probably shouldn't try to overwrite itself. 3. Speaking of, what are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/269878-rewrite-a-string-to-a-file-with-cron/#findComment-1387591 Share on other sites More sharing options...
jazzman1 Posted October 25, 2012 Author Share Posted October 25, 2012 Thanks @reguinix, now it works fine I have a few different scripts to send a mass of email running by cron in 0, 5, 10, 15, 20 min.. When the script is done, I want to rewrite the content with php exit function. Thank you again buddy Solved Quote Link to comment https://forums.phpfreaks.com/topic/269878-rewrite-a-string-to-a-file-with-cron/#findComment-1387592 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.