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. python3新特性函数注释Function Annotations用法分析

    本文分析了python3新特性函数注释Function Annotations用法.分享给大家供大家参考,具体如下: Python 3.X新增加了一个特性(Feature),叫作函数注释 Functi ...

  2. Python dict 存放函数

    Python 字典,可以直接存放函数,并执行正常. #!/usr/bin/python3 dict1 = dict() def test_fun(): print("test dict&qu ...

  3. pytorch torch.backends.cudnn设置作用

    cuDNN使用非确定性算法,并且可以使用torch.backends.cudnn.enabled = False来进行禁用 如果设置为torch.backends.cudnn.enabled =Tru ...

  4. [译]使用to_dict将pandas.DataFrame转换为Python中的字典列表

    pandas.DataFrame.to_json返回的是JSON字符串,不是字典. 可以使用to_dict进行字典转换. 使用orient指定方向. >>> df col1 col2 ...

  5. 【技术】Arduino PID自整定库

    最近看到了Brett Beauregard发表的有关PID的系列文章,感觉对于理解PID算法很有帮助,于是将系列文章翻译过来!在自我提高的过程中,也希望对同道中人有所帮助.作者Brett Beaure ...

  6. [转自baidu]修正古人五行,《七行说》之提出

    一.论原五行相生.相克关系不妥之处: 祖国医学原“五行说”即金.木.水.火.土.在五行学说中说相生规律为:金生水:水生木:木生火:火生土:土生金.相克规律为:火克金:金克木:木克土:土克水:水克火.这 ...

  7. java学习笔记(5)-排序(1)

    标签(空格分隔): 学习笔记 1. 冒泡 public class MaoPao{ public static void sort(int[] arr){ for(int i=arr.length-1 ...

  8. VMware vSphere6.0 服务器虚拟化部署安装图解(最全,最详细)-搭建的所有步骤

    VMware vSphere6.0 服务器虚拟化部署安装图解 一 .VMware vSphere部署的前期规划要点 1.vSphere的优点 (略) 2如何利用现在的设备架构虚拟化环境 在虚拟化过程中 ...

  9. LeetCode 151. 翻转字符串里的单词(Reverse Words in a String)

    151. 翻转字符串里的单词 151. Reverse Words in a String

  10. 使用ImagesPipeline时候报错为:ModuleNotFoundError: No module named 'scrapy.contrib'

    刚开始我是这样写的: 报错为: 哈哈,经过查阅资料,其实他是存在的,接下来修改如下: 经过运行结果如下: 问题解决,哈哈哈,搞定!!!!!!!!!!!!