踩坑 PHP Fatal Error Failed opening required File
使用 require 引用文件时,报错如下:
require 'https://dev.ryan.com/test.php';
[Sat Mar 19 23:10:50 2011] [warn] mod_fcgid: stderr:
PHP Fatal error: require_once() [function.require]: Failed opening required '/common/configs/config_templates.inc.php'
(include_path='.:/usr/share/pear:/usr/share/php') in /home/viapics1/public_html/common/configs/config.inc.php on line 158
原因是没理解虚拟服务器路径和文件系统路径。
require 使用文件系统路径,如
/home/viapics1/public_html/common/configs/config_templates.inc.php
解决方法:
先使用 $_SERVER['DOCUMENT_ROOT'] 获取 web 服务器根目录
修改后代码如下:
require_once $_SERVER['DOCUMENT_ROOT'].'/common/configs/config_templates.inc.php';
参考:
https://stackoverflow.com/questions/5364233/php-fatal-error-failed-opening-required-file
踩坑 PHP Fatal Error Failed opening required File的更多相关文章
- kinaba 安装踩坑: FATAL Error: [elasticsearch.url]: definition for this key is missing
操作系统:Linux kibana 版本: 7.4.0 1. 在/etc/yum.repos.d/ 下新建 kibana.repo 配置 yum 源地址 内容如下: [root@localhost ...
- kinaba 安装踩坑: FATAL Error: [elasticsearch.url]: definition for this key is missing 转
安装 https://www.jianshu.com/p/875457cb8da6 操作系统:Linux kibana 版本: 7.4.0 1. 在/etc/yum.repos.d/ 下新建 ...
- Symfony没有安装依赖_PHP Fatal error: require(): Failed opening required
$ php bin/console server:run PHP Warning: require(D:\home\workspace\pd\app/../vendor/autoload.php): ...
- PHP message: PHP Fatal error: require(): Failed opening required
PHP message: PHP Warning: require(/data/wwwroot/blog.sgfoot.com/bootstrap/autoload.php): failed to o ...
- TP5报错Fatal error: require(): Failed opening required '/home/www/xx/public/../thinkphp/start.php
https://jingyan.baidu.com/article/afd8f4deb784fe34e386e97b.html https://www.cnblogs.com/300js/p/9224 ...
- PHP错误解决:Fatal error: Unknown: Failed opening required ...
最近学习PHP,使用XAMPP在Ubuntu下配置完Apache等之后,尝试了一下,但出现如下错误: Warning: Unknown: failed to open stream: 鏉冮檺涓嶅 i ...
- Android Studio 首坑 Gradle sync failed: Cause: error in opening zip file 的错误
前言 今天安装Android studio 2.3.1时发生了一个错误,安装完成后创建第一个Hello World项目是报错.经过这个百度后,结果没有一个靠谱的.将拆解经过记录一下. 环境: 操作系统 ...
- Failed opening required
报错 点击页面右下角的图标,再点击错误可以显示报错.或者在项目中runtime--log也可以查看error [64]think\\__require_file(): Failed opening r ...
- 解决:[DCC Fatal Error] **.dpk : E2202 Required package '***' not found
//[DCC Fatal Error] **.dpk : E2202 Required package '***' not found 意思是:[DCC致命错误] *:e2202需包***没有发现 D ...
随机推荐
- Mantis-1.3.3 (Ubuntu 16.04)
平台: Ubuntu 类型: 虚拟机镜像 软件包: mantis-1.3.3 bug tracking commercial devops mantis open-source project man ...
- GIT教程笔记
GIT的工作流程: 先在工作目录中添加.修改文件 一般是在工作目录建立你的工程文件夹,然后通过命令行进入文件夹后 git init 初始化 将需要进行版本管理的文件放入缓存区 git add 文件 ...
- IOS 截屏(保存到相册中)
@interface NJViewController () /** * 点击截屏按钮 */ - (IBAction)captureView:(UIButton *)sender; /** * 白色v ...
- matlplotlib 为折线图填充渐变颜色
概要 本篇记录绘图时填充颜色时的一些常用设置,主要用到了 imshow,fill 函数. 填充图实例 填充的效果图如下: 图 1:渐变色效果图 可根据下方给出的代码进行自定义. #!/us ...
- 【luogu P1783 海滩防御】 题解
题目链接:https://www.luogu.org/problemnew/show/P1783 先把题目改造一下:题目所求是要一条能从0列到n列的路径,使其路径上的最大边长一半最小. 为什么是一半呢 ...
- 重温 JSP 与 Servlet
Java Web使用SSH框架多了,很多基础的 JSP 与 Servlet 的东西都忘记了.最近在 JSP 标签 和 Struts2 包装的 Session 对象的混合使用时弄晕了,就翻书温习下. J ...
- cookie 和 localStorage 、sessionStorage、 session不同
1. cookie:存储大小4k 有时间限制,会跟在ajax的请求头上 2. localStorage: 存储大小5M 没有时间限制 3. sessionStorage: 临时会话存储 当浏览器关闭的 ...
- abs的个人博客 http://abs001.top/blog
abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 abs的个人博客 a ...
- SAP系统管理中常见问题解答(转载)
1.如何查看SAP系统的位数? system——status看 Platform ID Platform 32-bit 64-bit --------------------------------- ...
- Python知识点入门笔记——Python的基本数据类型
Python的数字分为4种类型:整数(int).浮点数(float).布尔值(bool).复数(complex). type()函数可以知道数据的类型,如type(233)是int型,type(233 ...