duancheng6221 2017-07-26 22:19
浏览 407
已采纳

Lychee:文件上传错误 - 无法在第0行的Unknown中创建临时文件

I'm running Lychee on my server (photo hosting software). Everything works fine except the image upload. I get the following error:

PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0" while reading response header from upstream, client: 123.123.12.12, server: example.com, request: "POST /php/index.php HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "example.com", referrer: "example.com/"

2017/07/27 08:03:51 [error] 10711#10711: *183 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/) in Unknown on line 0

The error still exists after adding "/tmp" to "open_basedir"

open_basedir = "/var/www/:/tmp/"

And adding a tmp dir with www-http rights in /tmp

upload_tmp_dir = /tmp/http-upload
  • 写回答

1条回答 默认 最新

  • dongse5528 2017-07-30 21:56
    关注

    I had to add the open_basedir parameter in nginx

    location ~ \.php$ {
                    try_files  $uri =404;
                    fastcgi_pass 127.0.0.1:9000;
                    fastcgi_param PHP_VALUE open_basedir="/var/www/:/tmp/";
                    fastcgi_index  index.php;
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                    fastcgi_param  SCRIPT_NAME  $fastcgi_script_name;
                    include fastcgi_params;
            }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部