今天在使用禅道上传文件的时候发现了一个问题,我可以上传几十k的文件,但是上传不了大几M的文件,当文件过大的时候,一直卡在哪里,上传不了(使用的是开源版9.8.1)。
在官方文档中可以看到需要调整php.ini 中的 post_max_size 和 upload_max_filesize值,然后重启apache即可生效:
#cd /opt/zbox/etc/php#vim php.ini...........register_argc_argv = Offauto_globals_jit = Onpost_max_size = 50Mmagic_quotes_gpc = Offmagic_quotes_runtime = Offmagic_quotes_sybase = Off............file_uploads = Onupload_tmp_dir = "/opt/zbox/tmp/"upload_max_filesize = 50Mallow_url_fopen = Onallow_url_include = Offdefault_socket_timeout = 60............
进去之后看到我的是50M,说明不是空间的问题,接着从百度看到需要修改my.php中的$config->debug 参数,将false修改为true:
#cd /opt/zbox/app/zentao/config#vim my.php<?php$config->installed ??????= true;$config->debug ??????????= true;$config->requestType ????= ‘PATH_INFO‘;$config->db->host ???????= ‘127.0.0.1‘;$config->db->port ???????= ‘3307‘;$config->db->name ???????= ‘zentao‘;$config->db->user ???????= ‘root‘;$config->db->password ???= ‘123456‘;$config->db->prefix ?????= ‘zt_‘;$config->webRoot ????????= getWebRoot();$config->default->lang ??= ‘zh-cn‘;
重启之后再次提交,发现还是上传不了大文件,无奈,查看禅道的日志,发现里面有下面这样的报错:
16:02:30 ERROR: SQLSTATE[HY000] [1045] Access denied for user ‘root‘@‘localhost‘ (using password: YES) in /opt/zbox/app/zentaobiz/framework/base/router.class.php on line 2145, last called by /opt/zbox/app/zentaobiz/framework/base/router.class.php on line 2103 through function connectByPDO. in /opt/zbox/app/zentaobiz/framework/base/router.class.php on line 2196 when visiting
看日志似乎是权限的问题,这时候我就在想如果权限不对,为什么小文件就可以上传,而大文件不行,显然不对,接着在排查,突然想到是不是又是nginx代理的问题,又动手查看nginx的配置文件,在配置禅道代理的地方加入一行client_max_body_size 1024M;
#vim nginx.conf
worker_processes ?1; ???????events { ???????????????worker_connections ?1024; ???????} ???????http { ?????????????include ??????mime.types; ?????????????default_type ?application/octet-stream; ?????????????sendfile ???????on; ?????????????keepalive_timeout ?65;server ?{ ???listen 80; ???server_name zbox.gong-hui.com; ???location / { ???????client_max_body_size 1024M; ???????proxy_redirect off; ???????proxy_set_header Host $http_host; ???????proxy_set_header X-Real-IP $remote_addr; ???????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ???????proxy_pass http://192.168.3.175:81; ??????????????} ?}
接着重启nginx,然后进入禅道上传大文件,哇,成功上传!
关于禅道上传文件大小的问题
原文地址:https://www.cnblogs.com/heyongboke/p/8946988.html