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错误解决方法的更多相关文章

  1. lnmp 环境require(): open_basedir restriction in effect 错误

    最近配置开发用的lnmp环境,环境配置完成后,爆500错误,查看nginx错误日志 open_basedir 将 PHP 所能打开的文件限制在指定的目录树,包括文件本身 错误日志显示,访问脚本不在 o ...

  2. 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 ...

  3. php 环境require(): open_basedir restriction in effect 错误

    php 环境require(): open_basedir restriction in effect 错误 错误日志显示,访问脚本不在 open_basedir的限定目录里面 解决方法打开fastc ...

  4. PHPExcel中open_basedir restriction in effect的解决方法

    用PHPExcel做导出execl的时候发现在本地没有问题,但是把网站传到租用的服务器的时候就报错,具体如下: Warning: realpath() [function.realpath]: ope ...

  5. php Warning: require(): open_basedir restriction in effect File(/www/wwwroot/default/

    解决方案如下: 一.找到修改fastcgi的配置文件 (/usr/local/nginx/conf/fastcgi.conf) 二.vi进行编辑(保存退出) 三.对虚拟主机配置进行重写在Nginx低版 ...

  6. require(): open_basedir restriction in effect. 解决方法

    在linux服务器部署thinkphp5的时候PHP报了这个错误, 如下: Warning: require(): open_basedir restriction in effect. File(/ ...

  7. 宝塔部署时,出现“open_basedir restriction in effect”错误

    下面是错误代码: Warning: require(): open_basedir restriction in effect. Warning: require(XXXXXXXXXXX): fail ...

  8. require(): open_basedir restriction in effect. File

    新安装的 lnmp 环境,将项目放上报 require(): open_basedir restriction in effect. File 的错误! 错误日志显示,访问脚本不在 open_base ...

  9. 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 ...

随机推荐

  1. 025_Excel知识汇总

    一.Excel相对引用和绝对应用的区别 加上了绝对地址符“$”的列标和行号为绝对地址,在公式向旁边复制时不会发生变化,没有加上绝对地址符号的列标和行号为相对地址,在公式向旁边复制时会跟着发生变化. 具 ...

  2. MSYS2 编译环境配置

    博客转载自:https://medium.com/@fzubair/carnd-term2-gcc-setup-on-windows-287e1fd36845 2018/6/2 — mingw32/c ...

  3. 【Java】Swagger快速入门

    Swagger 简介 Swagger 是一套基于 OpenAPI 规范构建的开源工具,可以帮助我们设计.构建.记录以及使用 Rest API.Swagger 主要包含了以下三个部分: Swagger ...

  4. python初级(302) 3 easygui简单使用二

    一.复习 1.easygui 信息提示对话框 2.easygui 是否对话框 二.easygui其它组件 1.选择对话框:choicebox(msg, title, choices) import e ...

  5. 可扩展标记语言XML之一:XML的概念、作用与示例

    哈喽大家好啊,乐字节小乐又来给大家分享Java技术文章了.上次已经讲完了Java多线程相关知识(可以看我博客文章), 这次文章将讲述可扩展标记语言XML 一. 标记语言 标记语言,是一种将文本(Tex ...

  6. [转帖]Linux教程(21)-Linux条件循环语句

    Linux教程(21)-Linux条件循环语句 2018-08-24 16:49:03 钱婷婷 阅读数 60更多 分类专栏: Linux教程与操作 Linux教程与使用   版权声明:本文为博主原创文 ...

  7. [转帖]Reactor模式

    Reactor模式 https://www.cnblogs.com/crazymakercircle/p/9833847.html 看不懂代码 只看的图.. 疯狂创客圈,一个Java 高并发研习社群  ...

  8. JAVAWEB实现增删查改(图书信息管理)之添加功能实现

    addBooks.jsp页面代码:↓ <%-- Created by IntelliJ IDEA. User: NFS Date: 2019-7-12 Time: 14:30 To change ...

  9. day38——线程queue、事件event、协程

    day38 线程queue 多线程抢占资源 只能让其串行--用到互斥锁 线程queue 队列--先进先出(FIFO) import queue q = queue.Queue(3) q.put(1) ...

  10. 读写锁(ReentrantReadWriteLock)

    重点: 1.读锁共享 2.写锁互斥 3.读写锁互斥 锁降级:将写锁降级为读锁.(先获取写锁,再获取读锁,再释放写锁,最后释放读锁) 造成锁降级的原因:出于性能考虑,一般情况下,都将锁定的动作,精确到具 ...