使用EasyPHP我发现了一个令人讨厌的错误,我似乎无法修复。我搜索了互联网,得到了一些点击,但我从这些博文和页面中得不到任何东西。
PHP和Apache工作正常,但是当我想将MySQL与PEAR(包含在EasyPHP中)和我require("DB.php")
时使用时,我收到此错误:
Warning: require(DB.php) [function.require]: failed to open stream: No such file or directory in G:\Server\EasyPHP-5.3.3\www\tester.php on line 2
Fatal error: require() [function.require]: Failed opening required 'DB.php' (include_path='.;C:\php5\pear') in G:\Server\EasyPHP-5.3.3\www\tester.php on line 2
我的PHP脚本看起来像这样(它只是一个测试人员):
<?php
require "DB.php";
$db = DB::connect('mysql://root@localhost');
if (DB::isError($db)) { die("Can't connect:" . $db->getMessage()); }
?>
我尝试将"DB.php"
的路径更改为EasyPHP的“PHP”文件夹和"Php\PEAR"
以及各种奇怪的东西,但似乎没有任何效果;我得到相同的错误,但错误消息的第一行有不同的路径。
根据this page,这个错误是由于某些phar没有被删除或类似的东西引起的 - 我不明白这一点,也不理解上面提到的解决方法 the page
解决方法如下:
使用php -d运行分布式phar phar.require_hash = 0 go-pear.phar
< / p>
根本没有意义,如果你问我:)另一个选择是“下载go-pear的this non-pharred version并使用它。”开始有意义但是我接下来要去做什么呢?
我尝试了第一个解决方法,即使我不太了解它。我打开了CMD,它说:C:\Users\Lasse>
默认情况下(Lasse是我的名字)
我尝试打开包含go-pear.phar的文件夹。这是结果:
C:\Users\Lasse>cd G:\Server\EasyPHP-5.3.3\php\PEAR //*hit enter*
C:\Users\Lasse> //this was shown, typed content of the line below this
C:\Users\Lasse>php -d phar.require_hash=0 go-pear.phar //*hit enter*
'php' was not recogninzed as an intern or extern command, a program or a batchfile.
C:\Users\Lasse>
我无法修改>
中C:\Users\Lasse>
前面的内容。每当我输入一个不返回错误的命令(即我上面的样本的第一行)时,会显示一个双线换行符,后跟默认的C:\Users\Lasse>
。
对于你们中的许多人来说,这可能是一个意外,但对于数据库和PEAR来说,我是一个完整的 noob (对于自我反讽而言,这是一个很高的五个人)。另外,我刚刚安装了EasyPHP,所以请不要太苛刻。
另外...... 根据phpMyAdmin(也包含在EasyPHP中)我的MySQL版本是5.x(x意思是我不记得了)。这是否意味着我必须使用'mysqli://root@localhost'
?
答案 0 :(得分:1)
你无法在Windows中使用cd到其他驱动器。做:
g:
cd Server\EasyPHP-5.3.3\php\PEAR