php教程

php上传大文件报错Internal Server Error

我的站长站 2023-02-22 人阅读

php上传大文件报错Internal Server Error,导致文件上传失败。接下来我们就解决这个问题。

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

解决方案

首先修改php.ini 文件

max_execution_time = 600 ;每个PHP页面运行的最大时间值(秒),默认30秒
max_input_time = 600 ;每个PHP页面接收数据所需的最大时间,默认60秒
memory_limit = 8m ;每个PHP页面所吃掉的最大内存,默认8M

把上述参数修改后,在网络所允许的正常情况下,就可以上传大体积文件了

file_uploads = on ;这个很重要,必须要on才可以
upload_max_filesize = 32m ;根据需求改到最大
post_max_size = 32m ;表单提交的最大尺寸
file_uploads = On 这里设置是否允许HTTP上传,默认应该为ON的
upload_tmp_dir= 这里设置上传文件存放的临时位置,必须指定

如果以上配置都做最大修改了,还是报错,那么请再次修改Apache服务器设置

在httpd.conf 文件中添加以下代码段,重启Apache服务问题即可解决。

<IfModule mod_fcgid.c>
        AddHandler    fcgid-script .fcgi
        #
        FcgidConnectTimeout  20
        # to get around upload errors when uploading images increase the MaxRequestLen size to 15MB
        MaxRequestLen  157286400000
</IfModule>


相关推荐
  • php报错
  • php提示Notice: Undefined index报错解决方法

    Notice: Undefined index报错我的站长站在开发一个项目时,用$get获取网址参数值,非常简单一段代码,如下:$classid=$_GET[&#39;classid&#39;];运行发现php提示Notice: Undefined index的报错,网上找了下教程,Notice: Undefined index这个错误的意思是使用了...

    php教程 27 5个月前
  • php报错internal server error的解决办法

    php.ini 中缺省的最长执行时间是 30 秒,这是由 php.ini 中的 max_execution_time 变量指定,倘若你有一个需要颇多时间才能完成的工作,例如要发送很多电子邮件给大量收件者,或者要进行繁重的数据分析工作,服务器会在 30 秒后强行中止正在执行的程序,如何解...

    php教程 61 1年前
  • PHP报错Warning: Unknown: Input variables exceeded 1000

    PHP报错:Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0原因是一次性提交表单数据或输入的变量数量超过默认1000个的限制了。解决方法我们只需要修改下这个默认10...

    php教程 20 1年前
最新更新