我正在我的服务器上运行荔枝 (照片托管软件)。除了图片上传,一切都很好。我得到以下错误:
PHP警告:文件上传错误--无法在第0行中创建未知的临时文件“,同时从上游读取响应头,客户端: 123.123.12.12,服务器: example.com,请求:"POST / PHP /index.php HTTP/2.0",上游:”example.com://127.0.0.1:9000“,主机:"example.com",参考者:"example.com/” 2017/07/27 08:03:51错误10711#10711:*183 FastCGI在stderr中发送:"PHP消息: PHP警告: open_basedir限制生效。文件(/tmp)不在第0行允许的路径:(/var/www/)中。
将"/tmp“添加到"open_basedir”后,该错误仍然存在
open_basedir = "/var/www/:/tmp/"并在/tmp中添加具有www-http权限的tmp dir。
upload_tmp_dir = /tmp/http-upload发布于 2017-07-31 05:56:00
我必须在nginx中添加open_basedir参数。
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;
}https://stackoverflow.com/questions/45342778
复制相似问题