开发者

PEAR "DB.php" error using EasyPHP

开发者 https://www.devze.com 2023-01-13 04:55 出处:网络
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.

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 thou开发者_StackOverflow社区gh 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'?


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

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

精彩评论

暂无评论...
验证码 换一张
取 消