前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Fatal error: require(): Failed opening required ‘/www/wwwroot/xxxxxx/public/../thinkphp/start.php

Fatal error: require(): Failed opening required ‘/www/wwwroot/xxxxxx/public/../thinkphp/start.php

作者头像
全栈程序员站长
发布2022-09-23 10:41:40
2.2K0
发布2022-09-23 10:41:40
举报

大家好,又见面了,我是你们的朋友全栈君。

项目场景:

在CentOS8中安装了宝塔,配置thinkphp5.1版本环境时出了问题,在此之前网站虚拟域名成功配置,能够访问站点创建成功的页面


问题描述:

在访问tp5默认页面时报错

代码语言:javascript
复制
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/xxxxxx/thinkphp/start.php) is not within the allowed path(s): (/home/wwwroot/xxxxxx/public/:/tmp/:/proc/) in /home/wwwroot/xxxxxx/public/index.php on line 16

Warning: require(/home/wwwroot/xxxxxx/thinkphp/start.php): failed to open stream: Operation not permitted in /home/wwwroot/xxxxxx/public/index.php on line 16

Fatal error: require(): Failed opening required ‘/www/wwwroot/xxxxxx/public/../thinkphp/start.php’ (include_path=’.:/usr/local/php/lib/php’) in /home/wwwroot/xxxxxx/public/index.php on line 16

原因分析:

起初看英文提示,以为是文件缺少,随后找了一下,发现文件都是在的。然后第二段警告提示了权限不足,又去修改权限,还是不行。后来发现是open_basedir的问题,那么有两个方法来解决这个问题。


解决方案:

1、在设置网站目录中,不要勾选防跨站攻击,问题解决。

2、进入/www/server/nginx/conf目录下,找到fastcgi.conf,修改其中的一个参数’fastcgi_param PHP_ADMIN_VALUE’,没有的话可以自己加一个,/www/wwwroot是你的项目路径,每个人可能都不一样

代码语言:javascript
复制
fastcgi_param  PHP_ADMIN_VALUE    "open_basedir=/www/wwwroot/:/tmp/:/proc/";

两种方法任选其一即可

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/172110.html原文链接:https://javaforall.cn

本文参与?腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体分享计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 项目场景:
  • 问题描述:
  • 原因分析:
  • 解决方案:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com