php上传大文件报错Internal Server Error

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

1

2

3

4

5

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 文件

1

2

3

max_execution_time = 600 ;每个PHP页面运行的最大时间值(秒),默认30秒

max_input_time = 600 ;每个PHP页面接收数据所需的最大时间,默认60秒

memory_limit = 8m ;每个PHP页面所吃掉的最大内存,默认8M

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

1

2

3

4

5

file_uploads = on ;这个很重要,必须要on才可以

upload_max_filesize = 32m ;根据需求改到最大

post_max_size = 32m ;表单提交的最大尺寸

file_uploads = On 这里设置是否允许HTTP上传,默认应该为ON的

upload_tmp_dir= 这里设置上传文件存放的临时位置,必须指定

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

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

1

2

3

4

5

6

7

<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>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

执刀人的工具库

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值