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条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么