laravel部署linx报错 Unknown: open_basedir restriction in effect. File is not within the allow

在将本地开发的项目部署到Linux服务器后,遇到无法访问的问题,错误信息显示'Noinputfilespecified.'。经排查,问题源于PHP的open_basedir限制。错误日志指出,项目的根目录未包含在允许的路径中。解决方案是在nginx的fastcgi配置文件中添加网站根目录,并重启nginx服务。具体操作为编辑fastcgi.conf,修改fastcgi_param PHP_ADMIN_VALUE行,添加网站路径,然后重启nginx。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在本地开发的项目放到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即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值