服务器在完成PHP中的完整执行之前终止进程

I am trying to run a php file through cron job. It starts the running well but after a certain time period,the server is terminating it's execution.

So that I can't get my desired output. I am taking the output in a text file. After start the cron, it store some output into the text file but before completing full execution, it is terminating the process.

I also called mail function at beginning and ending of the file. But I only got the beginning message.

I set the max_time, max_memory to the infinite and also checked the settings from php_info().

Everything is ok there but file is not completing its execution successfully. I am able to run the file through browser but it requires a very long time.

So I must do it with others way like cron. If any one provide me a better solution in this regard, I will be grateful.

Turn off safe_mode in php.ini and change maximum execution time by adding

set_time_limit(0)

At the beginning of your script php set_time_limit function