配置PHP 2M限制
编译安装PHP后,把编译目录中的php.ini-development文件,复制到/usr/local/bin/php -i 中写的ini目录里并改名为php.ini,然后编辑文件:
upload_max_filesize = 500M ;上传文件上限 post_max_size = 500M ;上传文件上限默认大小为8M max_execution_time = 1800 ; Maximum execution time of each script, in seconds脚本最大执行时间 max_input_time = 1800 ; Maximum amount of time each script may spend parsing request data memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)内存上限
upload_max_filesize
和 post_max_size
是 PHP 配置文件中两个不同的参数,它们都是用来限制上传文件的大小。其中,upload_max_filesize
是指上传文件的最大大小,而 post_max_size
则是指 POST 数据所允许的最大大小。¹²
具体来说,post_max_size
是一个超集,它检查所有类型的 POST 数据,而 upload_max_filesize
只与文件上传有关。如果要上传一个大文件,则需要更改这两个限制。²
一般来说,应该将 memory_limit
设置为大于 post_max_size
,而将 post_max_size
设置为大于 upload_max_filesize
。
max_input_time 是每个脚本可以花在解析请求数据上的最大时间,单位是秒。如果设置了 max_input_time (即值不等于-1,-1可以认为是在CLI模式下),在 php_request_startup () 阶段会设置一个定时器,超时时间为 max_input_time;在 php_execute_script () 阶段会重新设置一个定时器,超时时间为 max_execution_time。¹²³
这个配置项的作用是限制脚本解析输入数据(类似 POST 和 GET)允许的最大时间。如果超过这个时间,PHP 将会停止解析输入数据并且会返回一个错误信息。³
源: 与必应的对话, 2023/4/14(1) 浅析PHP配置文件中的几种超时配置-php教程-PHP中文网. https://www.php.cn/php-weizijiaocheng-489696.html 访问时间 2023/4/14.
(2) [PHP] 配置文件中的超时时间解析 | PHP 技术论坛. https://learnku.com/articles/31309 访问时间 2023/4/14.
(3) php.ini中的常用配置详解-php教程-PHP中文网. https://www.php.cn/php-weizijiaocheng-390988.html 访问时间 2023/4/14.
(4) 在php.ini中把max_input_time 和 max_execution_time设置得特别长会有什么影响?比如1小时。. https://zhidao.baidu.com/question/404078733.html 访问时间 2023/4/14.
(5) php配置文件中的超时时间max input timeout_Eric-liang的博客-CSDN博客. https://blog.csdn.net/lwj19921222/article/details/112000585 访问时间 2023/4/14. (6) php参数max_input_time,PHP文件上传是否受到max_input_time的影响?. https://blog.csdn.net/weixin_35216469/article/details/115808990 访问时间 2023/4/14. (7) PHP timeout情况【PHP】配置文件中的超时时间解析Mon1st的博客-CSDN博客. https://blog.csdn.net/weixin_29446529/article/details/115100047 访问时间 2023/4/14. (8) php参数max_input_time,linux中php修改max_input_vars、max_execution_time、max …. https://blog.csdn.net/weixin_30512965/article/details/115808989 访问时间 2023/4/14. (9) PHP timeout情况【PHP】配置文件中的超时时间解析_Mon1st的博客-CSDN博客. https://blog.csdn.net/weixin_29446529/article/details/115100047 访问时间 2023/4/14.
(10) 浅析PHP配置文件中的几种超时配置-php教程-PHP中文网. https://www.php.cn/php-weizijiaocheng-489696.html 访问时间 2023/4/14.
(11) php配置文件中的超时时间_max input timeout_Eric-liang的博客-CSDN博客. https://blog.csdn.net/lwj19921222/article/details/112000585 访问时间 2023/4/14.