2010-08-27 97 views
0

使用EasyPHP我發現了一個惱人的錯誤,我似乎無法修復。我搜索了互聯網,得到了一些點擊,但是我從這些博客文章和頁面中沒有獲得任何收益。使用EasyPHP PEAR「DB.php」錯誤

PHP和Apache工作正常,但是當我想使用PEAR的MySQL(包含在的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://[email protected]'); 
if (DB::isError($db)) { die("Can't connect:" . $db->getMessage()); } 
?> 

我試圖改變到的EasyPHP的和"Php\PEAR"的「PHP」 -folder和古靈精怪的東西,但沒有任何的"DB.php"路徑似乎工作;我得到了相同的錯誤,但在錯誤消息的第一行中使用了不同的路徑。

根據this page這個錯誤是由沒有得到pharred一些藥業事情或類似的東西引起的 - 我不明白,任何的這個,我也不知道在the page提到解決方法

解決方法如下:

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

是沒有意義的,如果你問我:)另一種選擇是「下載的去梨的事情,使用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(擊掌自我諷刺)。另外,我只是安裝EasyPHP,所以請不要太苛刻。

另外...根據phpMyAdmin(它也包含在EasyPHP中)我的MySQL版本是5.x(x意思是我不記得了)。這是否意味着我必須使用'mysqli://[email protected]'

回答

1

您無法在Windows中切換到其他驅動器。做:

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