Today, I found a problem when using ZenTao to upload files. I can upload files of dozens of kilobytes, but I can't upload files of several megabytes. Open source version 9.8.1).
In the official documentation, you can see that you need to adjust the post_max_size and upload_max_filesize values in php.ini, and then restart apache to take effect:
#cd /opt/zbox/etc/php #vim php.ini ........... register_argc_argv = Off auto_globals_jit = On post_max_size = 50M magic_quotes_gpc = Off magic_quotes_runtime = Off magic_quotes_sybase = Off ............ file_uploads = On upload_tmp_dir = "/opt/zbox/tmp/" upload_max_filesize = 50M allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 ............
After I went in, I saw that mine was 50M, indicating that it was not a space problem. Then I saw from Baidu that I needed to modify the $config->debug parameter in my.php, and change false to 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';
After restarting, I submitted it again, and found that I still could not upload the large file. I had no choice but to check the Zendao log and found the following error:
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
Looking at the log, it seems to be a problem of permissions. At this time, I was thinking about why small files can be uploaded if the permissions are wrong, but large files can't, which is obviously wrong. Then I was investigating, and suddenly I thought whether it was a problem with nginx proxy again, and I started again. View the configuration file of nginx, and add a line of client_max_body_size 1024M to the place where ZenTao proxy is configured;
#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; } }
Then restart nginx, and then enter Zen Tao to upload large files, wow, successfully uploaded!