简体   繁体   English

PHP:无法延长函数的执行时间

[英]PHP: Cant extend execution time of function

I have an app that scans 100+ domains at the same time my problem is the execution time, I cant extend more than 1.8 min, and displays 404 not found. 我有一个应用程序扫描100多个域同时我的问题是执行时间,我不能延长超过1.8分钟,并显示404找不到。

This is my code on testing the execution time. 这是我测试执行时间的代码。

<?php
ini_set('max_execution_time', 300);
// current time
echo date('h:i:s') . "\n";

sleep(120);

// wake up !
echo date('h:i:s') . "\n";

?>

I want to run my functions until it finishes its task. 我想运行我的函数,直到它完成任务。

I hope you can help me. 我希望你能帮助我。

Thanks. 谢谢。

You can not change this setting with ini_set() when running in safe mode. 在安全模式下运行时,无法使用ini_set()更改此设置。 The only workaround is to turn off safe mode or by changing the time limit in the php.ini. 唯一的解决方法是关闭安全模式或更改php.ini中的时间限制。

If you dont have access to php.ini contact your service provider. 如果您无法访问php.ini,请联系您的服务提供商。

Other option is set bacground script or cronjob on server which takes task from database and maintain its result and create webservice that will montior this process. 其他选项是在服务器上设置bacground脚本或cronjob,它从数据库中获取任务并维护其结果并创建将监视此过程的webservice。

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

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