uktrips007 Posted December 14, 2006 Share Posted December 14, 2006 Hi friends!!I have developed a page that take back up of database in php.Now it is working fine if I run this php script through linux shell, but at the same itme it get failed when i run this using crontab or web browser.Can you please help me out to get the solution.Thanks ???Uttam. Link to comment https://forums.phpfreaks.com/topic/30599-crontab-error/ Share on other sites More sharing options...
btherl Posted December 14, 2006 Share Posted December 14, 2006 It could be failing due to the working directory, particularly if you use relative paths to include other files. It also could be failing due to permission problems.For this kind of "blind" debugging, you can try logging debugging output to a file. A good start is to have a line at the very top of your script like[code=php:0]file_put_contents('/tmp/I_have_run.' . posix_getpid(), date('[Y-m-d H:i:s] Script executed';[/code]That'll create a file each time your script runs. If the file isn't created, that means the script is not even starting. Or the script is not allowed to write to /tmp (quite possible if it's running under the web browser). Try putting that both before and after any include() or require() you may have. Link to comment https://forums.phpfreaks.com/topic/30599-crontab-error/#findComment-140947 Share on other sites More sharing options...
uktrips007 Posted December 14, 2006 Author Share Posted December 14, 2006 Hi dear!Thanks for your prompt answer.but I have checked permission it's fine.Also I never use relative path and have used complete path.but it's not running from crontab of a specific user.but it is running from shell as well as root crontab.permission is also 755so i think it must run.can u help me. Link to comment https://forums.phpfreaks.com/topic/30599-crontab-error/#findComment-141056 Share on other sites More sharing options...
slashpine Posted December 14, 2006 Share Posted December 14, 2006 just curious....did you compose the script on a Windows system?The reason I ask is that some shell scripts will not execute from a crontab if there are unfamiliar (text) characters that may be hidden. some "Window's" apps leave hidden characters within a text file that can cause problems running scripts from CRON. I have had scripts that work fine when executed from a bash prompt but would not execute when called from a crontab.sory if this does no apply to your problem...Good Luck Link to comment https://forums.phpfreaks.com/topic/30599-crontab-error/#findComment-141194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.