VPS侦探论坛

 找回密码
 注册
查看: 5399|回复: 6

LNMP 1.4 Beta Warning: include_once(): open_basedir restriction in effect.

[复制链接]
发表于 2017-2-5 04:16:51 | 显示全部楼层 |阅读模式

Warning: include_once(): open_basedir restriction in effect. File(/webs/app/t/index2.php) is not within the allowed path(s): (/webs/app/t/t_template/:/tmp/:/proc/) in /webs/app/t/t_template/index.php on line 5

Warning: include_once(/webs/app/t/index2.php): failed to open stream: Operation not permitted in /webs/app/t/t_template/index.php on line 5

Warning: include_once(): Failed opening '../index2.php' for inclusion (include_path='.:/usr/local/php/lib/php') in /webs/app/t/t_template/index.php on line 5


php.ini 下是注释掉的,这个目录下( chattr -i
/webs/app/t/t_template/.user.ini => 没有那个文件或目录 当尝试对/webs/app/koubei/.user.ini进行...)也没有 .user.ini
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-2-5 04:29:46 | 显示全部楼层


目录下没有这个文件,自己在目录下创建一个 .user.ini 然后设置后重启PHP也不行.
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-5 04:33:42 | 显示全部楼层

是默认的 default 改过来的.不是lnmp 命令创建的.
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-5 08:35:22 | 显示全部楼层



1.4上不需要放跨目录还需要将/usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";删除
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2017-3-31 11:32:04 | 显示全部楼层

回复 4# 的帖子


军哥,我添加的网站的时候使用的是/home/yaf目录 然后nginx里的root 也是指向/home/yaf
后来 我把/home/yaf/index.php文件移动到了/home/yaf/public目录下,就是和Laravel框架一样的入口结构

然后我引用了上一级目录就报错
Warning: realpath(): open_basedir restriction in effect. File(/home/yaf) is not within the allowed path(s): (/home/yaf/public/:/tmp/:/proc/) in /home/yaf/public/index.php on line 4

我需要防跨站功能,然后.user.ini里是open_basedir=/srv/code/yaf/:/tmp/:/proc/  

├── application
│   ├── controllers
│   ├── library
│   ├── models
│   ├── plugins
│   └── views
│       ├── error
│       └── index
├── conf
└── public

军哥运维代购:http://shop63846532.taobao.com/

发表于 2017-3-31 20:51:44 | 显示全部楼层

回复 5# 的帖子


看你网站目录结构,你这些文件应该是都需要调用的,你网站目录应该就是public的上级目录
.user.ini 的目录就应该和网站上的设置一样都是public的上级目录
发表于 2017-4-4 11:29:08 | 显示全部楼层

回复 6# 的帖子


谢谢军哥。
之前没有删除/usr/local/nginx/conf/fastcgi.conf里的最后一行,对比看了1.3是没有最后一行的,1.4加了这个。我说怎么设置.user.ini都不起效果
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-27 12:11 , Processed in 0.027270 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表