dsc6517 2015-11-30 11:40
浏览 485
已采纳

PHP最长执行时间为30秒

I have a strange problem, my localhost and server has the same max_execution_time which is 30 seconds.

But in the server its working without any problem but in the localhost only i am getting the error of Maximum execution time of 30 seconds exceeded.

The data set is also same i am using to run.

What are the major items that can cause max_execution_time exceeded error?

PHP settings on server

max_execution_time  30  30
max_file_uploads    20  20
max_input_nesting_level 64  64
max_input_time  60  60
max_input_vars  1000    1000
memory_limit    128M    128M

PHP settings on localhost

max_execution_time  30  30
max_file_uploads    20  20
max_input_nesting_level 64  64
max_input_time  60  60
max_input_vars  1000    1000
memory_limit    128M    128M

Can the RAM of the computer and Ram of the Server cause this problem ? if so the only difference is i have a 8 gb ram in my computer and 2 gb ram in the server.

  • 写回答

2条回答 默认 最新

  • dongtan8122 2015-11-30 11:51
    关注

    If the exact same code is used on both machines, your issue either is the CPU / processing speed of your machine (less likely) or the amount of data your code is processing (more likely).

    Strictly speaking however, if your code is hitting the max execution time, you should be looking at reducing the amount of processing your code does in one execution. If your code is build to handle / process a large amount of requests, consider adding a maximum amount of data to process in one request to stagger / batch process them instead. (E.g. Instead of processing 100 rows/requests at once, set a cap at 25 and stagger it over 4 executions of your code).

    If it's one large process, you may instead want to look at increasing the cap on your maximum execution time instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?