PHP-无法在xampp中更改max_execution_time

mk_*_*_89 8 php time web-crawler

我已经尝试了一切来改变max_execution_timePHP爬虫脚本,以便它可以运行无限的时间.

我已将php.ini文件设置更改max_execution_time0100000000但没有更改

我也尝试过使用PHP脚本本身设置它 ini_set('max_execution_time', 0);

所有的PHP脚本都会抛出相同的错误Fatal error: Maximum execution time of 3000 seconds exceeded,我可能会错过什么,如何确保没有最大执行时间限制?

PHP脚本

<?php
ini_set('MAX_EXECUTION_TIME', -1);
error_reporting(E_ALL);  // turn on all errors, warnings and notices for easier debugging
//ini_set('max_execution_time', 123456);
ini_set('max_input_time', -1);
ini_set('memory_limit', '512M');
set_time_limit(0);
date_default_timezone_set('Europe/London');

/*code which scrapes websites*/

?>
Run Code Online (Sandbox Code Playgroud)

phpinfo()函数

max_execution_time  0   0
max_input_time     -1   -1
Run Code Online (Sandbox Code Playgroud)

Ja͢*_*͢ck 3

您不应该让您的爬虫在 apache 下运行,最好通过 cli 作为Gearman设置的一部分独立运行它。

这样它就不会占用您的网络服务器,并且可以根据您的需要运行多久。您可以找到许多可以使用的 Gearman 绑定,当然包括 PHP。