LNMP - Warning: require(): open_basedir restriction in effect错误解决方法
LNMP 1.4或更高版本如果不想用防跨目录或者修改.user.ini的防跨目录的目录还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,需要重启nginx。
出现此类问题一般为open_basedir的问题(open_basedir的值来设置限制访问的目录或删除来移除防跨目录的设置。)
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/xlboo.com/bootstrap.php) is not within the allowed path(s): (/home/wwwroot/xlboo.com/public/:/tmp/:/proc/) in /home/wwwroot/xlboo.com/public/index.php on line 7
Warning: require(/home/wwwroot/xlboo.com/bootstrap.php): failed to open stream: Operation not permitted in /home/wwwroot/xlboo.com/public/index.php on line 7
Fatal error: require(): Failed opening required '/home/wwwroot/xlboo.com/public/../bootstrap.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/xlboo.com/public/index.php on line 7
方法一
删除user.ini
去权后删除即可
chattr -i .user.ini
此方法限制于当前的站点解决
php.ini的说明:https://lnmp.org/faq/lnmp-vhost-add-howto.html#user.ini
方法二
编辑
vim /usr/local/nginx/conf/fastcgi.conf
删除或注释掉这一行(*注释的话前面加“#”号即可)
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
此方法限制于所有的LNMP站点解决
方法三
编辑user.ini
chattr -i .user.ini
vimuser.ini
将
open_basedir=/home/wwwroot/xlboo.com/:/tmp/:/proc/
改为
open_basedir=/home/wwwroot/xlboo.com/public/ :/tmp/:/proc/
然后
chattr +i .user.ini
最后重启PHP或者Nginx
重启PHP
/etc/init.d/php-fpm restart
重启Nginx
service nginx restart
LNMP - Warning: require(): open_basedir restriction in effect错误解决方法的更多相关文章
- lnmp 环境require(): open_basedir restriction in effect 错误
最近配置开发用的lnmp环境,环境配置完成后,爆500错误,查看nginx错误日志 open_basedir 将 PHP 所能打开的文件限制在指定的目录树,包括文件本身 错误日志显示,访问脚本不在 o ...
- Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/../thinkphp/start.php) is not within the allowed path(s):
Warning: require(): open_basedir restriction in effect. File(/www/wwwroot//../thinkphp/start.php) is ...
- php 环境require(): open_basedir restriction in effect 错误
php 环境require(): open_basedir restriction in effect 错误 错误日志显示,访问脚本不在 open_basedir的限定目录里面 解决方法打开fastc ...
- PHPExcel中open_basedir restriction in effect的解决方法
用PHPExcel做导出execl的时候发现在本地没有问题,但是把网站传到租用的服务器的时候就报错,具体如下: Warning: realpath() [function.realpath]: ope ...
- php Warning: require(): open_basedir restriction in effect File(/www/wwwroot/default/
解决方案如下: 一.找到修改fastcgi的配置文件 (/usr/local/nginx/conf/fastcgi.conf) 二.vi进行编辑(保存退出) 三.对虚拟主机配置进行重写在Nginx低版 ...
- require(): open_basedir restriction in effect. 解决方法
在linux服务器部署thinkphp5的时候PHP报了这个错误, 如下: Warning: require(): open_basedir restriction in effect. File(/ ...
- 宝塔部署时,出现“open_basedir restriction in effect”错误
下面是错误代码: Warning: require(): open_basedir restriction in effect. Warning: require(XXXXXXXXXXX): fail ...
- require(): open_basedir restriction in effect. File
新安装的 lnmp 环境,将项目放上报 require(): open_basedir restriction in effect. File 的错误! 错误日志显示,访问脚本不在 open_base ...
- thinkPHP5配置nginx环境无法打开(require(): open_basedir restriction in effect. File(/mnt/hgfs/root/tp5/thinkphp/start.php) is not within the allowed path(s)
今天想把玩一下tp5,结果怎么都无法访问,每次都是报500错误,我把错误提示都打开看到下面的错误 require(): open_basedir restriction in effect. File ...
随机推荐
- EFProf用法
SQL Server Profiler用来跟踪应用程序发送到SQL Server中的SQL语句,用于检测性能,查找问题.Entity Framework 也有它的跟踪工具EFProf,用于跟踪Enti ...
- 爬虫urllib2中Handler处理器和自定义Opener
Handler处理器 和 自定义Opener opener是 urllib2.OpenerDirector 的实例,urlopen是一个特殊的opener(也就是模块已经构建好的). 但是基本的url ...
- linux下node.js 查版本号和更新 how to update node
我用的Mac,不是windows,不太清楚那个怎么搞. Linux下就是终端直接命令 //查版本号 node --version // v6.10.1 我很久没更了 //更新 //先清理Npm的cac ...
- 用于抓取vijos所有题目信息的node.js脚本
代码如下: var superagent = require('superagent'); var fs = require('fs'); /* fetch_vijos_problems 这个脚本用于 ...
- Java之整数运算
Java的整数运算遵循四则运算规则,可以使用任意嵌套的小括号.四则运算规则和初等数学一致.例如: public class Main { public static void main(String[ ...
- Oracle-关于Oracle.ManagedDataAccess
今天调用webservice的时候,运行程序后开始报错以下的错误信息 “/”应用程序中的服务器错误. 未能加载文件或程序集“Oracle.DataAccess”或它的某一个依赖项.试图加载格式不正确的 ...
- 如何杀死处于进程状态D的进程
D状态的就是 uninterruptible sleep ,此时进程不能被信号唤醒,GDB等调试工具也不能对它调试,因为GDB也是用到了信号,也杀不死它 D状态的形成 如何分析D状态 cat /pro ...
- 【C/C++开发】STL erase()函数使用要小心
http://blog.sina.com.cn/s/blog_67b6b720010114d3.html erase()函数的功能是用来删除容器中的元素 删除某个容器里的某个元素:c.erase(T) ...
- SpringBoot常用注解(一)
控制层:controller 1.@RestController注解相当于@ResponseBody + @Controller合在一起的作用.即这样写每一个方法返回的是 JSON 类型的数据. 2. ...
- Qt deletelater函数分析(1)
生活的全部意义在于无穷地探索尚未知道的东西,在于不断地增加更多的知识.--左拉 该函数是QObject类的函数: ---- ...