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 ...
随机推荐
- [译]为什么在__new __()后总是调用__init __()?
原文来源: https://stackoverflow.com/questions/674304/why-is-init-always-called-after-new 需要控制新实例的创建时,请使用 ...
- 【翻译】Flink Table Api & SQL —Streaming 概念 ——时间属性
本文翻译自官网: Time Attributes https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/table/str ...
- vue强制刷新组件 ----组件重置到初始状态
把一个组件重置到初始状态是一个常见的需求,推荐的做法有两种,一种是父组件重置子组件的 prop,另一种是子组件暴露一个重置的方法供父组件调用.但有些时候,子组件既没有提供重置的方法,也没提供 prop ...
- kali 扫描之burp Suite学习笔记1
1 安装 2 burs功能图解 3 工具栏详解 4 实战 (1) 网络配置 一台kali 一台msf 网络采用nat nat网络设置方法: 查看路由 配置文件 (2) 代理设置 bur代理设置 浏览器 ...
- csu 1987: 绚丽的手链
1987: 绚丽的手链 Submit Page Summary Time Limit: 6 Sec Memory Limit: 512 Mb Submitted: 13 ...
- 九、Spring中使用@Value和@PropertySource为属性赋值
首先回顾下在xml中我们是如何为spring的bean进行属性赋值呢? 大体是这样的 <bean id="person" class="com.atguigu.be ...
- 怎么又出错了?盘点java中最容易出现的错误
现如今,java已经广泛应用各种软件开发领域.基于面向对象的设计,java屏蔽了诸如C,C++等语言的一些复杂性,提供了垃圾回收机制,平台无关的虚拟机技术,Java创造了一种前所未有的开发方式.所以, ...
- QT/C++ 类型转换
"轻轻地我走了,正如我轻轻地来,我挥一挥衣袖,不带走一片云彩"------阿魔 1) int转为QString: QString::number(int) 2) std::stri ...
- 关于MySQL的内连接,外连接的总结
首先创建两个数据库表,用户表u,账户表a 先看一下数据库表: u表: a表: 1. 内连接. 关键字:inner join SQL语句: select u.*,a.ID as aid,a.mon ...
- 端口占用问题:java.net.BindException: Address already in use: bind
解决方法 方法一:换一个端口 若仍然想要使用该端口,则可以将占用该端口的进程杀死即可. 方法二:杀死占用该端口的进程 若仍然想要使用该端口,则可以将占用该端口的进程杀死即可 查找端口被占用的进程id ...