PHP Failed opening required (include_path='.;C:\php\pear')
来源:互联网 发布:食品制造业数据 编辑:程序博客网 时间:2024/06/08 04:53
今天在做一个MVC程序时 ,required路径时报错,再三感觉自己程序没错后走上了无尽的百度之路,不得不说百度解决方法都是千篇一律。这里写上我自己的问题;
不得不说解决问题这个问题前自己再三的去看看自己的程序写对了没有;
看看自己写对了没有;
再确定一遍自己的程序 逻辑思维。
重要的事情说三遍。。
比如我犯得错误。
这是我的文件目录:
我的index文件中是这么写的:
<?php /** *程序入口文件 */ //设置默认的入口文件 $default_controller = 'Main'; $default_action = 'Index'; $current_controller = isset($_GET['c']) ? $_GET['c'] : $default_controller; $current_action = isset($_GET['a']) ? $_GET['a'] : $default_action; define('CONTROLLER', $current_controller); define('ACTION', $current_action); require 'Controller/'.CONTROLLER.'.class.php'; $controller_use = CONTROLLER . 'Controller'; $controller = new $controller_use(); $action_use = ACTION . 'Action'; $controller -> $action_use(); ?>
很明显我声明了一个默认的controller下的默认action方法
然后我默认的maincontroller里这样写的:
<?php /** * 主控制器(默认控制器) * 显示主页 */ class MainController { public function IndexAction() { //require 'D:/PHP/wamp/www/myShop/View/index.html'; require '../View/index.html' ; } } ?>
看到这里 大家知道为啥出错了吗?
很明显(其实也不明显,以前也没写到过) require中的路径是应该跟index.php持平。应该与index.php持平。应该从入口文件来判定路径。应该为./View/index.html重要的事情说三遍,告诫下我自己,也告诉可能会犯错的你们。
自此别再确定你自己的路径一定对 ,再去把他确认一遍。
不行请试试绝对路径能不能执行,能的话多半是你自己路径问题。
如果真的不行的话,请试试以下方法。
以下方法是我在网上看了这么多后的总结。建议按照顺序执行。
1. 文件夹不要用中文,因为配置文件的编码模式不一定支持中文
2. PHP Failed opening required PHP没有开放的要求 尝试请给你的项目完全控制权限
3. 网上提到的:去掉修改 common.inc.php里所有 ‘./ 为 ’/ (就是把中间的点去掉),将”index.php”等根目录的php文件里面的./include/….”里的”./”完全删除。就可以正常访问。(未经测试慎用)
4. nclude_path=’.;C:\php5\pear’ 用wamp中的php安装的路径(文件夹不用中文名)include_path=’C:\php5\pear’ 或在php.ini里面有这一行,去掉句首的’;’,然后重启WEB服务器。;include_path = “.;d:\AppServ\www\ZendFramework-1.5.0RC1\library” (同样未经测试 慎用 个人感觉没有什么原理)
最后两项建议慎用,如果不能修改还是建议还原操作,毕竟是环境配置。
希望对你有所帮助!!
- PHP Failed opening required (include_path='.;C:\php\pear')
- Fatal error: Unknown: Failed opening required 'c:/wamp/www/view.php' (include_path='.
- php中遇到include_path='.;C:\php5\pear'的错误
- Php中include_path='.;C:\php5\pear'错误
- PHP Fatal error: Unknown: Failed opening required
- Failed opening required 'bootstrap/../vendor/autoload.php'
- php中提示Fatal error: require(),“include_path=’.;c:\php5\pear’”错误的解决方法
- Fatal error: require() [function.require]: Failed opening required 'db.php'
- php include_path
- PHP 报错 Warning: Unknown: failed to open stream Fatal error: Unknown: Failed opening required
- php中 include_path='.;c:php5pear'的错误解决
- yii框架搭建问题:PHP Fatal error: require_once(): Failed opening required
- Laravel 5 Failed opening required bootstrap/../vendor/autoload.php 报错
- include_path='.;C:\php5\pear'错误的解决方法
- appserv关于include_path='.;C:\php5\pear'的错误处理
- laravel php -S 自定义域名 -t 目录 ,报错 PHP Fatal error: Unknown: Failed opening required 'public/' (include
- php include_path设置
- php include_path设置
- hdu1195
- 【技巧】robot查看为执行完成日志
- Erlang学习笔记(二)
- Linux系统编程--文件(三)
- 【日常练习 搜索】诡异的楼梯(队列+bfs)
- PHP Failed opening required (include_path='.;C:\php\pear')
- 我们的ACM训练计划(新东方)
- 组播学习笔记
- 狄利克雷过程理解
- BaseActivity 里到底应该写哪些内容?
- 为什么在行人检测中,HOG特征比Haar特征更精确?
- c++陷阱
- Hibernate学习笔记----组件映射
- HTML5一些语义化的标签以及在IE6~8兼容性问题