problem about installing pear

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

problem about installing pear

Post by PHPycho »

i installed the pear but wasnt successfull
i got the following errors
Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\Rajendra\pear\DB.php on line 30

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;C:\php5\pear') in C:\wamp\www\Rajendra\pear\DB.php on line 30
i did the following
1>go to the go-pear.dat and run
2>chose for local and conitnued
3>everything went ok
Lots of files appeared in c:\wamp\php\PEAR including go-pear.phar

i went to the root folder and copied the downloaded pear DB package where there was DB.php and many more..but there wasnt PEAR.php
and when i executed this query

Code: Select all

<?
$dbhost = 'localhost';
$dbtype = 'mysql';
$dbuser = 'root';
$dbpass = '';
$dbname = 'test';
require_once( 'DB.php' );
$db = DB::connect( "$dbtype://$dbuser:$dbpass@$dbhost/$dbname" );
// no need to select DB
$sql = 'SELECT * FROM category';
$demoResult = $db->query($sql);
while ($demoRow = $demoResult->fetchRow()) {
    echo $demoRow[2] . '<br>';
}
$db->disconnect();

?>
and i got the above errors. I dont know where i did st wrong.

i am currently running wamp . Can anybody give me a exact installation of pear DB in wamp.
Thanks in advance to all of DevNetworkians !!
Last edited by PHPycho on Thu Jan 11, 2007 9:51 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Note the include_path setting and where the files are.
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

Thanks i forgot to mention that
i uncommented the include_path under windows and edited as
include_path = "c:\php\pear"
and restarted the wamp and still nothing went ok
Help again
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

DidnÄt the installer ask wether it should change the php.ini setting or not?
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

i reinstalled again and noticed following warning which i didnt noticed
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<C:\wamp\php\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.

Notice: Use of undefined constant WINDOWS - assumed 'WINDOWS' in phar://go-pear
phar/PEAR/Start.php on line 333

Current include path : .;C:\php5\pear
Configured directory : C:\wamp\php\pear

............................................................................
i dont know what to do next. Again appeal for help
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Add or alter the existing include_path to include C:\wamp\php\pear

:|
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

And then double-check with this little script

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

echo 'ini: ', get_cfg_var('cfg_file_path'), "<br />\n";
echo 'include: ', get_cfg_var('include_path'), "<br />\n";
echo 'file: ', __FILE__, "<br />\n";
require 'PEAR.php';
?>
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

i get rid off that warning message
Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\Rajendra\pear\DB.php on line 30

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;C:\php5\pear') in C:\wamp\www\Rajendra\pear\DB.php on line 30
but nothing was appeared on the page, just a blank page
the echo below

Code: Select all

$db = DB::connect( "$dbtype://$dbuser:$dbpass@$dbhost/$dbname" );
didnt appeared
only above above was appeared .
whats the problem ? appealing for help again
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Did you look through your error logs? They should be in the Apache directories under "logs."
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

$db = DB::connect( "$dbtype://$dbuser:$dbpass@$dbhost/$dbname", array('debug'=>5));
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

Thanks Mr. volka and others
Finally i solved my problems. Actually I had put the DB class files in the root directory, which rather should be put in the installed dir ie c:\wamp\pear\php\PEAR and i finally got success.
Thanks for everybody for helping me.
Hope this will help others also.
Always hope for the best
Last edited by PHPycho on Fri Jan 12, 2007 7:50 pm, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

:?:
Usually you do not have to do anything but install pear and then install necessary packages e.g via command line

Code: Select all

pear install -o File_Archive
There's no need to copy files manually.
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

oooooh thas pretty cooooool
anyway

Code: Select all

$thanks += 1;
Mr. Volka
Post Reply