问题详情
php再上传的时候可能会出现这个报错,导致文件上传失败。接下来我们就解决这个问题。
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服务器设置
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在上传大文件时遇到的InternalServerError错误。通过调整php.ini配置,如增加max_execution_time、max_input_time、memory_limit等参数,以及设置file_uploads和upload_max_filesize,可以有效提升文件上传的容量限制。同时,对于Apache服务器,还需修改httpd.conf文件中的MaxRequestLen参数。
本文详细介绍了如何解决PHP在上传大文件时遇到的InternalServerError错误。通过调整php.ini配置,如增加max_execution_time、max_input_time、memory_limit等参数,以及设置file_uploads和upload_max_filesize,可以有效提升文件上传的容量限制。同时,对于Apache服务器,还需修改httpd.conf文件中的MaxRequestLen参数。
           
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                   842
					842
					
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            