Page 1 of 1

problem about installing pear

Posted: Thu Jan 11, 2007 9:38 pm
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 !!

Posted: Thu Jan 11, 2007 9:51 pm
by feyd
Note the include_path setting and where the files are.

Posted: Thu Jan 11, 2007 10:02 pm
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

Posted: Thu Jan 11, 2007 10:22 pm
by volka
DidnÄt the installer ask wether it should change the php.ini setting or not?

Posted: Thu Jan 11, 2007 10:41 pm
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

Posted: Thu Jan 11, 2007 10:47 pm
by feyd
Add or alter the existing include_path to include C:\wamp\php\pear

:|

Posted: Thu Jan 11, 2007 11:08 pm
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';
?>

Posted: Thu Jan 11, 2007 11:30 pm
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

Posted: Thu Jan 11, 2007 11:42 pm
by feyd
Did you look through your error logs? They should be in the Apache directories under "logs."

Posted: Fri Jan 12, 2007 12:16 am
by volka
try

Code: Select all

$db = DB::connect( "$dbtype://$dbuser:$dbpass@$dbhost/$dbname", array('debug'=>5));

Posted: Fri Jan 12, 2007 7:36 pm
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

Posted: Fri Jan 12, 2007 7:45 pm
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.

Posted: Fri Jan 12, 2007 8:00 pm
by PHPycho
oooooh thas pretty cooooool
anyway

Code: Select all

$thanks += 1;
Mr. Volka