0

使用 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"以及各种奇怪的东西,但似乎没有任何效果;我收到相同的错误,但错误消息的第一行中的路径不同。

根据这个页面,这个错误是由一些 phar 事情没有得到 pharred 或类似的东西引起的 - 我不明白这些,也不明白页面上提到的解决方法

解决方法如下:

使用 php -d phar.require_hash=0 go-pear.phar 运行分布式 phar

如果你问我,这根本没有意义:) 另一种选择是“下载这个非共享版本的 go-pear 并使用它。” 开始说得通了,但那我该怎么处理去梨的东西呢?

我尝试了第一个解决方法,即使我不太了解它。我打开 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>

我无法编辑 in 前面的>内容C:\Users\Lasse>。每次我输入一个不返回错误的命令(即我上面示例的第一行)时,都会显示一个双换行符,然后是默认值C:\Users\Lasse>

这可能会让你们中的许多人感到惊讶,但当谈到数据库和 PEAR 时,我是一个完全的菜鸟(自我讽刺的高五)。另外,我刚刚安装了 EasyPHP,所以请不要太苛刻。

另外...根据 phpMyAdmin(也包含在 EasyPHP 中),我的 MySQL 版本是 5.x(x 表示我不记得的东西)。这是否意味着我必须使用'mysqli://root@localhost'

4

1 回答 1

1

您不能 cd 到 Windows 中的其他驱动器。做:

 g:
 cd Server\EasyPHP-5.3.3\php\PEAR
于 2010-10-12T08:40:31.167 回答