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. 运维笔记--Linux查找指定目录下某段时间的文件

    查找指定目录下,60天之前的文件:find /mnt/xml_data -mtime +60 -name "*.xml" 找到并统计数量:find /mnt/xml_data -m ...

  2. 【翻译】Flink Table Api & SQL —Streaming 概念 ——动态表

    本文翻译自官网:Flink Table Api & SQL 动态表 https://ci.apache.org/projects/flink/flink-docs-release-1.9/de ...

  3. GoLand 2019.1 激活破解

    链接://https://blog.csdn.net/hi_liuxiansheng/article/details/89078405

  4. QT_QML 界面设计Row和Column布局

    Column与Row的使用方式类似,下面以Column为例子: Column{ x: label_poseParamValue.x + label_poseParamValue.width + 10 ...

  5. spring的面试

    IOC IOC(Inversion Of Controll,控制反转)是一种设计思想,将原本在程序中手动创建对象的控制权,交由给Spring框架来管理.IOC容器是Spring用来实现IOC的载体,I ...

  6. Fineui 解决OnClientClick中无论是返回true或false,都依然执行后台代码的问题

    有时写js代码验证数据,需要在OnClientClick中执行,如果符合条件执行后台代码,不符合则不触发后台代码.刚开始的时候无论返回true或false都会执行后台代码(asp.net写法),看了h ...

  7. Java基础笔试练习(九)

    1.下面所示的java代码,运行时,会产生()类型的异常 ? int Arry_a[] = new int[10]; System.out.println(Arry_a[10]); A.Arithme ...

  8. CEF4Delphi 常用设置

    CEF4Delphi是由 SalvadorDíazFau 创建的一个开源项目,用于在基于Delphi的应用程序中嵌入基于Chromium的浏览器. CEF4Delphi 基于Henri Gourves ...

  9. Python操作MongoDB查询时处理ObjectId

    从bson中导入ObjectId对象,将字符串转换成id对象查询使用: from bson import ObjectId import pymongo conn = pymongo.MongoCli ...

  10. centos7编译安装memcached

    1.libevent 源码地址:https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent ...