如何增加php中的执行超时?

php
2022-08-30 07:12:18

如何增加交易超时?我想上传视频,但大尺寸的视频没有上传?

它引发错误The process *** exceeded the timeout of 60 seconds.


答案 1

您需要更改 php 中的一些设置.ini:

upload_max_filesize = 2M 
;or whatever size you want

max_execution_time = 60
; also, higher if you must - sets the maximum time in seconds

PHP.ini所在的位置取决于您的系统环境。有关更多信息,请 http://php.net/manual/en/ini.list.php


答案 2

您应该能够在运行时使用

set_time_limit(100);

http://php.net/manual/en/function.set-time-limit.php

或在虚拟主机配置中

php_admin_value max_execution_time 10000

对于不太可靠的应用程序,出于性能原因,将全局执行时间限制设置为LOW主要是一个好主意。因此,您可能希望只允许这些脚本运行更长时间,而这些脚本绝对必须运行。

p.s.:不要忘记post_max_size和upload_max_filesize(就像第一个答案告诉allready)


推荐