在我的 php 脚本中,较大的文件需要更长的上传时间,并且受 max_execution_time 的限制

发布于 2024-10-07 09:57:18 字数 441 浏览 0 评论 0原文

在我的 php 脚本中,较大的文件需要更长的时间才能上传,并且受 max_execution_time 的限制。当 max_execution_time 设置为 60 并且我上传小于 1MB 的文件时,没有问题。一旦我上传了超过 3MB 的文件,我就会一直看到空白屏幕,但没有任何错误。

不要担心所有上传限制都已设置,并且 php 显示错误已打开。我能够确定问题的唯一方法是将 max_execution_time 设置为 360。

一旦我这样做,就会出现超时并且上传成功。

我的问题是允许用户上传更晚的文件,并且现在无法知道设置 max_execution_time 多长时间。

如果它设置得非常高,就像我将其设置为 360 秒一样,那么这意味着理论上每个 php 进程可能需要长达 360 秒的时间来执行,这可能非常糟糕。

请有人帮助我。这是一个文件托管脚本。

谢谢。

In my php script larger file takes longer to upload and its bound by max_execution_time. when max_execution_time was set to 60 and i was uploading files under 1MB there was no problem. once i uploaded a file over 3MB i kept getting a blank screen with no error on it.

Dont worry all upload limits are set and yes php display errors is on. The only way i was able to determine the problem was when i set my max_execution_time to 360.

Once i did that there was time out and upload went through successfully.

my problem is that users are allowed to upload much later files and there is no way of nowing how long to set max_execution_time for.

If it is set really high, like how i have it set to 360 seconds, then that means in theory every php process can take up to 360 seconds to execute, which can be very bad.

Someone please help me. This is a file hosting script.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乄_柒ぐ汐 2024-10-14 09:57:18

仅当用户上传文件时才更改最大执行时间。

ini_set('max_execution_time', 360);

Change the max execution time only when users are uploading files.

ini_set('max_execution_time', 360);
溺ぐ爱和你が 2024-10-14 09:57:18

我相信设置 'max_input_time' php.ini 变量只会影响输入变量的解析,其中包括 POSTed 文件上传。

I believe setting the 'max_input_time' php.ini variable will only affect the parsing of input variables, which includes POSTed file uploads.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文