<i id='9yS9H'><tr id='9yS9H'><dt id='9yS9H'><q id='9yS9H'><span id='9yS9H'><b id='9yS9H'><form id='9yS9H'><ins id='9yS9H'></ins><ul id='9yS9H'></ul><sub id='9yS9H'></sub></form><legend id='9yS9H'></legend><bdo id='9yS9H'><pre id='9yS9H'><center id='9yS9H'></center></pre></bdo></b><th id='9yS9H'></th></span></q></dt></tr></i><div id='9yS9H'><tfoot id='9yS9H'></tfoot><dl id='9yS9H'><fieldset id='9yS9H'></fieldset></dl></div>

      <bdo id='9yS9H'></bdo><ul id='9yS9H'></ul>

    1. <small id='9yS9H'></small><noframes id='9yS9H'>

    2. <legend id='9yS9H'><style id='9yS9H'><dir id='9yS9H'><q id='9yS9H'></q></dir></style></legend>

        <tfoot id='9yS9H'></tfoot>

      1. 在 PHP 中增加 max_execution_time ?

        时间:2023-05-20
        <legend id='K0UTJ'><style id='K0UTJ'><dir id='K0UTJ'><q id='K0UTJ'></q></dir></style></legend>
            <bdo id='K0UTJ'></bdo><ul id='K0UTJ'></ul>

          • <tfoot id='K0UTJ'></tfoot>

            <small id='K0UTJ'></small><noframes id='K0UTJ'>

            <i id='K0UTJ'><tr id='K0UTJ'><dt id='K0UTJ'><q id='K0UTJ'><span id='K0UTJ'><b id='K0UTJ'><form id='K0UTJ'><ins id='K0UTJ'></ins><ul id='K0UTJ'></ul><sub id='K0UTJ'></sub></form><legend id='K0UTJ'></legend><bdo id='K0UTJ'><pre id='K0UTJ'><center id='K0UTJ'></center></pre></bdo></b><th id='K0UTJ'></th></span></q></dt></tr></i><div id='K0UTJ'><tfoot id='K0UTJ'></tfoot><dl id='K0UTJ'><fieldset id='K0UTJ'></fieldset></dl></div>

                  <tbody id='K0UTJ'></tbody>

                1. 本文介绍了在 PHP 中增加 max_execution_time ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试将大文件上传到我的服务器(我的服务器支持 post_max_size 192mb 和 max_execution_time 600 秒).当我上传 100mb 文件时,执行将在 600 秒后停止,因此文件不会上传到服务器.如何在 PHP 中增加 max_execution_time(仅用于文件上传过程)?我试过了:

                  I'm trying to upload large files to my server (my server support post_max_size 192mb and max_execution_time 600 sec). When I upload 100mb files execution will stop after 600 sec so files are not uploaded to the server. How can I increase max_execution_time in PHP (only for the file uploading process)? I have tried:

                  ini_set ( 'max_execution_time', 1200); 
                  if(move_uploaded_file($_FILES['Video']['tmp_name'],$tmppath)) {
                    // ...
                  } 
                  

                  有什么想法可以克服这个问题吗?

                  Any ideas how I can overcome this?

                  推荐答案

                  将此添加到 htaccess 文件中(并查看下面添加的编辑注释):

                  Add this to an htaccess file (and see edit notes added below):

                  <IfModule mod_php5.c>
                     php_value post_max_size 200M
                     php_value upload_max_filesize 200M
                     php_value memory_limit 300M
                     php_value max_execution_time 259200
                     php_value max_input_time 259200
                     php_value session.gc_maxlifetime 1200
                  </IfModule>
                  

                  其他资源和信息:

                  • https://www.php.net/manual/en/info.configuration.php

                  https://www.looklinux.com/how-to-set-php-maximum-execution-time-in-an-htaccess-file/

                  2021 年

                  随着 PHP 和 Apache 的发展和壮大,我认为花点时间提及一些需要考虑的事情和可能的陷阱"对我来说很重要.考虑:

                  As PHP and Apache evolve and grow, I think it is important for me to take a moment to mention a few things to consider and possible "gotchas" to consider:

                  • PHP 可以作为模块或 CGI 运行.建议以 CGI 运行,因为它为攻击向量创造了很多机会 [阅读更多].如果加载了 中的特定模块,作为模块运行(更安全的选项)将触发要使用的设置.
                  • 答案表明在第一行写mod_php5.c.如果您使用的是 PHP 7,则将其替换为 mod_php7.c.
                  • 有时在更改 .htaccess 文件后,重新启动 Apache 或 NGINX 将不起作用.最常见的原因是您正在运行 PHP-FPM,它作为一个单独的进程运行.您也需要重新启动它.
                  • 请记住,这些设置通常在您的 php.ini 配置文件中定义.此方法通常仅在您的托管服务提供商不授予您更改这些文件的权限时才有用.在您可以编辑 PHP 配置的情况下,建议您在那里应用这些设置.
                  • 最后,需要注意的是,并非所有 php.ini 设置都可以通过 .htaccess 文件进行配置.php.ini 指令的文件列表可以在在这里找到,并且唯一可以更改的是可更改列中具有模式 PHP_INI_ALLPHP_INI_PERDIR 中的那些.
                  • PHP can be run as a module or as CGI. It is not recommended to run as CGI as it creates a lot of opportunities for attack vectors [Read More]. Running as a module (the safer option) will trigger the settings to be used if the specific module from <IfModule is loaded.
                  • The answer indicates to write mod_php5.c in the first line. If you are using PHP 7, you would replace that with mod_php7.c.
                  • Sometimes after you make changes to your .htaccess file, restarting Apache or NGINX will not work. The most common reason for this is you are running PHP-FPM, which runs as a separate process. You need to restart that as well.
                  • Remember these are settings that are normally defined in your php.ini config file(s). This method is usually only useful in the event your hosting provider does not give you access to change those files. In circumstances where you can edit the PHP configuration, it is recommended that you apply these settings there.
                  • Finally, it's important to note that not all php.ini settings can be configured via an .htaccess file. A file list of php.ini directives can be found here, and the only ones you can change are the ones in the changeable column with the modes PHP_INI_ALL or PHP_INI_PERDIR.

                  这篇关于在 PHP 中增加 max_execution_time ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  • <legend id='lylh0'><style id='lylh0'><dir id='lylh0'><q id='lylh0'></q></dir></style></legend>

                    <tfoot id='lylh0'></tfoot>

                  • <i id='lylh0'><tr id='lylh0'><dt id='lylh0'><q id='lylh0'><span id='lylh0'><b id='lylh0'><form id='lylh0'><ins id='lylh0'></ins><ul id='lylh0'></ul><sub id='lylh0'></sub></form><legend id='lylh0'></legend><bdo id='lylh0'><pre id='lylh0'><center id='lylh0'></center></pre></bdo></b><th id='lylh0'></th></span></q></dt></tr></i><div id='lylh0'><tfoot id='lylh0'></tfoot><dl id='lylh0'><fieldset id='lylh0'></fieldset></dl></div>

                      <small id='lylh0'></small><noframes id='lylh0'>

                          <tbody id='lylh0'></tbody>
                          <bdo id='lylh0'></bdo><ul id='lylh0'></ul>