PEAR“DB.php”使用 EasyPHP 时出错

发布于 2024-09-16 04:45:53 字数 2413 浏览 5 评论 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 或类似的东西引起的 - 我不明白其中任何一个,也不明白 中提到的解决方法。 pear.php.net/2009/07/01/php-53-windows-and-pear/" rel="nofollow noreferrer">页面

解决方法如下:

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

如果你问我的话,根本没有任何意义:) 另一种选择是“下载这个非 pharred 版本< /a> 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>

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

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

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

Using EasyPHP I've discovered an annoying error I can't seem to fix. I searched the internet, got a few hits, but I gained nothing from these blog posts and pages.

PHP and Apache works fine, but when I want to use MySQL with PEAR (which is included in EasyPHP) and when I require("DB.php") I get this error:

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

My PHP script looks like this (it's just a tester):

<?php
require "DB.php";
$db = DB::connect('mysql://root@localhost');
if (DB::isError($db)) { die("Can't connect:" . $db->getMessage()); }
?>

I have tried changing the path of "DB.php" to the "PHP"-folder of EasyPHP and to "Php\PEAR" and all sorts of weird stuff but nothing seems to work; I get the same error but with a different path in the first line of the error message.

According to this page this error is caused by some phar thing not getting pharred or something like that - I don't understand any of this, nor do I understand the workaround mentioned on the page.

The workaround is as follows:

Run the distributed phar with php -d phar.require_hash=0 go-pear.phar

Makes no sense at all, if you ask me :) Another option is to "download this non-pharred version of the go-pear thing and use it." Starting to make sense but what am I then going to do with the go-pear thingy?

I tried the first workaround even though I don't really understand it. I opened CMD and it said: C:\Users\Lasse> by default (Lasse is my name)

I tried opening the folder containing the go-pear.phar. This is the outcome:

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>

I can't edit what is in front of the > in C:\Users\Lasse>. Everytime I enter a command which returns no error (i.e. the first line of my above sample) a double linebreak followed by the default C:\Users\Lasse>is shown.

This might come as a surprise to many of you but I am a complete noob when it comes to databases and PEAR (high-five for self-irony). Also, I just installed EasyPHP so please don't be too harsh.

Also... according to phpMyAdmin (which is also included in EasyPHP) my MySQL version is 5.x (x meaning something I don't remember). Does this mean I have to use 'mysqli://root@localhost'?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

榕城若虚 2024-09-23 04:45:54

在 Windows 中,您无法将 CD 切换到其他驱动器。做:

 g:
 cd Server\EasyPHP-5.3.3\php\PEAR

you cannot cd to a different drive in windows. do:

 g:
 cd Server\EasyPHP-5.3.3\php\PEAR
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文