use of register_shutdown_function |
[eluser]Unknown[/eluser]
Hello! I'm new working with Code Igniter and I have some doubts about the register_shutdown_function. My application has different controllers. Each of these controllers, with the curl library go to a site and read some news. I have a crontab in charge to execute this controllers every 15 minutes. Sometimes the sites are not working properly and I have a Fatal error: Maximum execution time of 300 seconds exceeded. I would like to use the register_shutdown_function to send myself a mail for letting me know that a problem is happening with one of my controllers because the site doesn't answer in 5 minutes. The problem I have that always that is giving me the fatal error it's in a different file that it's not my controller file. I don't know how to manage it. It's very important for me to solve it because if not my crontab goes crazy. Thank you very much in advance.
[eluser]weboap[/eluser]
and the CI Hooks wont work for you?? http://ellislab.com/codeigniter/user-gui...hooks.html Hook point :post_controller
[eluser]Unknown[/eluser]
Thank you for the suggestion, I tried it but it doesn't work. When there is not any problem the hook send an email, but when the fatal error comes (Fatal error: Maximum execution time of 300 seconds exceeded), the hook doesn't do anything.
[eluser]weboap[/eluser]
another suggestion to use Simultaneuos requests as per this page : http://www.phpied.com/simultaneuos-http-...with-curl/ and set the CURLOPT_TIMEOUT to less than 300 , after it timeout you can test the results before to store them. if the feed is ok save it, if not use the one in the cache till next cron run , then in the mean time send you a report if any failed and which one exactly. following is some links that may help explained it better: http://stackoverflow.com/questions/63750...st-timeout http://stackoverflow.com/questions/50011...e-function hope it help. |
Welcome Guest, Not a member yet? Register Sign In |