我正在我的服务器上运行荔枝(照片托管软件(。除了图像上传外,一切正常。我收到以下错误:
PHP消息:PHP 警告:文件上传错误 - 无法创建 读取响应标头时,第 0 行的未知临时文件" 从上游,客户端:123.123.12.12,服务器:example.com, 请求:"POST/php/index.php HTTP/2.0",上游: "fastcgi://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(不在 允许的路径:(/var/www/( 在第 0 行的未知中
将"/tmp"添加到"open_basedir"后,错误仍然存在
open_basedir = "/var/www/:/tmp/"
并在/tmp 中添加具有 www-http 权限的 tmp 目录
upload_tmp_dir = /tmp/http-upload
我不得不在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;
}