简体   繁体   English

如何在PHP中增加max_execution_time

[英]How to increase max_execution_time in PHP

I want to increase max_execution time for my site. 我想增加我的网站的max_execution时间。 I have tried some methods to do this with out any success and need help. 我尝试了一些方法来完成此操作,但没有成功,需要帮助。

What I already tried: 我已经尝试过的

  • I set my site in sub-folder I have create php.ini for that folder and along with set max_execution_time=259200 我在子文件夹中设置了站点,并为该文件夹创建了php.ini并设置了max_execution_time=259200
  • In my code file I set set_ini('max_execution_time','259200') 在我的代码文件中,设置set_ini('max_execution_time','259200')
  • I set root php.ini max_execution_time 我设置根php.ini max_execution_time

How can I set max_execution_time from cpanel for my server? 如何通过cpanel为服务器设置max_execution_time

What I already done: 我已经做了什么:

  1. change php.ini increase max_execution_time = 2592000 更改php.ini增加max_execution_time = 2592000
  2. add set_ini('max_execution_time','2592000'); 添加set_ini('max_execution_time','2592000'); in my script file in starting of file 在我的脚本文件的文件开头
  3. add set_time_limit(2592000); 添加set_time_limit(2592000); in my script file in starting of file 在我的脚本文件的文件开头
  4. concern with host provider due to shared server support doesn't work 由于共享服务器支持而与主机提供程序有关的问题不起作用

You can set the limit with set_time_limit() http://www.php.net//manual/en/function.set-time-limit.php 您可以使用set_time_limit() http://www.php.net//manual/en/function.set-time-limit.php设置限制

But you can only change this if the admin of your hosting server has allowed you to do so. 但是,只有在托管服务器的管理员允许的情况下,您才能更改此设置。

You can shoot them an email and ask for what you want or if they don't allow it, change your code into executable chunks that each run only a couple sec(or less) and a loop that calls all of them. 您可以向他们发送电子邮件并询问您想要什么,或者如果他们不允许,则将您的代码更改为可执行块,每个块仅运行几秒钟(或更短的时间),然后执行一个调用所有块的循环。

Depending on your application this could be done any number of ways and might be a different question altogether. 根据您的应用程序,这可以通过多种方式完成,并且可能完全是另一个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM