搜索您想要的文章


php上传大文件报错Internal Server Error

作者:Admin采集插件 时间:2023-04-08 浏览:967 分类:php教程 来源:互联网收录

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 [email protected] 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>


本文章来自互联网,有问题请联系QQ:1739635


免责声明:1.凡本站注明“来源:XXX(非CMS自动采集助手)”的作品,均转载自其它媒体,所载的文章、图片、音频视频文件等资料的版权归版权所有人所有,如有侵权,请联系[email protected]处理;2.凡本站转载内容仅代表作者本人观点,与CMS自动采集助手无关。