最近在本地开发的项目放到linux上以后访问不成功,页面显示No input file specified.错误
找到error.log一看错误为
FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/home/wwwroot/web/public/index.php) is not within the allowed path(s): () in Unknown on line 0PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0Unable to open primary script: /home/wwwroot/web/public/index.php (Operation not permitted)" while reading response header from upstream, client: 0.0.0.0, server: web.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "xxxx.com"
原因为我们访问的地址没有在open_basedir限制的范围之内,所以我们需要把我们的网站目录添加进去
我的环境是lnmp,解决办法为:
编辑fastcgi.conf
vim /usr/local/nginx/conf/fastcgi.conf
找到fastcgi_param PHP_ADMIN_VALUE这一行把我们网站的根目录加入进去
然后重启nginx即可