简体   繁体   English

php.ini中max_execution_time的最大允许值是多少

[英]What is the maximum allowed value of max_execution_time in php.ini

I tried increasing the value of max_execution_time in php using我尝试在 php 中使用增加 max_execution_time 的值

ini_set('max_execution_time', 108000);

which equals to 30 hours.相当于 30 小时。 I was just playing with this value to crawl websites with large amount of data in it.我只是在玩这个值来抓取包含大量数据的网站。 But, I go this fatal error that said the maximum execution time cannot exceed 30 seconds.但是,我遇到了这个致命错误,说最大执行时间不能超过 30 秒。 When I changed 108000 value to 300, my script executed for 5 minutes.当我将 108000 值更改为 300 时,我的脚本执行了 5 分钟。 I wonder what is the maximum allowed value for this thing in php?我想知道 php 中这个东西的最大允许值是多少?

Correct answer in reference to Mjh's comment.参考 Mjh 的评论的正确答案。

Signature for parsing integer ini values:用于解析整数 ini 值的签名:

ZEND_API long zend_ini_long(char *name, uint name_length, int orig);

Therefore the maximum value that can be entered into that field is: 2147483647因此,可以在该字段中输入的最大值是:2147483647

Old answer.旧答案。

The only clue I could find was here: https://github.com/php/php-src/blob/master/main/php_ini.h我能找到的唯一线索在这里: https : //github.com/php/php-src/blob/master/main/php_ini.h

#define php_ini_long    zend_ini_long

Which eventually leads back to: https://github.com/php/php-src/blob/master/Zend/zend_long.h最终回到: https : //github.com/php/php-src/blob/master/Zend/zend_long.h

typedef int64_t zend_long;

That is a 64 bit integer, or:那是一个 64 位整数,或者:

−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

EDIT: Correction.编辑:更正。

// PHP x64
typedef int64_t zend_long;

// PHP x86
typedef int32_t zend_long;

So the max value is PHP_INT_MAX .所以最大值是PHP_INT_MAX

If you are getting errors saying it cannot exceed 30 seconds, this is because your server configuration has forbidden changing that value to anything above 30 seconds.如果您收到错误说它不能超过 30 秒,这是因为您的服务器配置禁止将该值更改为超过 30 秒的任何值。

Quoting the manual set_time_limit引用手册set_time_limit

seconds The maximum execution time, in seconds.最大执行时间,以秒为单位。 If set to zero, no time limit is imposed.如果设置为零,则没有时间限制。

It maybe unlimited so perhaps for php the limit is just the maximum int value.它可能是无限的,所以对于 php 来说,限制只是最大的int值。

But there could be external factors, if I remember correctly suhosin patch have its own maximum execution time if executed from a web server maybe the server itself have some limit, looking at php sources I've the impression also network timeouts may be a factor.但是可能有外部因素, 如果我没记错的话 如果 从 Web 服务器 执行 suhosin补丁有自己的最大执行时间 也许服务器本身有一些限制,查看php 源我的印象也是网络超时可能是一个因素。

暂无
暂无

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

相关问题 在FTP中使用php.ini更改max_execution_time - change max_execution_time with php.ini in FTP phpMyAdmin 超时不考虑 PHP.ini max_execution_time - phpMyAdmin timeout not respecting PHP.ini max_execution_time 如何在运行时覆盖max_execution_time的php.ini值? - How can I override the php.ini value of max_execution_time at runtime? 如何在不更改 php.ini max_execution_time 的情况下避免超过 Laravel 的最大执行时间 60 秒 - How to avoid Maximum execution time of 60 seconds exceeded Laravel without change php.ini max_execution_time 如何在php.ini中更改upload_max_filesize和max_execution_time? - How do I change upload_max_filesize and max_execution_time in php.ini? 更改了php.ini中的max_execution_time设置,Drupal仍然存在问题 - Changed setting in php.ini for max_execution_time, Drupal still having problems php.ini 中的 max_execution_time 不会更新,其他设置会 - max_execution_time in php.ini wont update, other settings will 最长执行时间php.ini - Max execution time php.ini 我的共享服务器的全局php.ini将cronjob限制为max_execution_time为30秒,无法导入大文件 - Global php.ini of my shared server limits cronjob to max_execution_time to 30 seconds cannot import large file max_execution_time不起作用,但在回声ini_get('max_execution_time')上,它显示了我提供的时间 - max_execution_time not working but on echo ini_get('max_execution_time') it shows the time what i provide
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM