Page 1 sur 1

[PEAR] Problème avec include path sous wamp

Posté : 03 août 2010, 23:16
par ferv21
Bonjour
J'ai installer PEAR en exécutant go-pear.bat, et pour comprendre j'ai installer le package DB en ligne de commande.
J'ai créer un fichier index1.php dans le répertoire WWW.
Voici le code source:
<?php
$user = 'root';
$passwd = '';
$mysqlServer = 'localhost';
$dataBaseName ='test';

set_include_path(get_include_path() . ";c:\php\pear");

include('DB.php');
$dsn ='mysql://'.$user.':'.$passwd.'@'.$mysqlServer.'/'.$dataBaseName;
$db =& DB::connect($dsn);
if (DB::isError($db)) {
    die($db->getMessage());}
echo 'la connexion a reussie' ; 
$db->disconnect();
?>
Le problème vient du path car j'ai un message d'erreur de ce type:

Warning: include(DB.php) [function.include]: failed to open stream: No such file or directory in E:\wamp2\www\Nouveau dossier\index1.php on line 9

Warning: include() [function.include]: Failed opening 'DB.php' for inclusion (include_path='.;C:\php5\pear;c:\php\pear') in E:\wamp2\www\Nouveau dossier\index1.php on line 9

Fatal error: Class 'DB' not found in E:\wamp2\www\Nouveau dossier\index1.php on line 13


Wamp est installer dans le lecteur E: je ne comprend pas pour quoi ca me met c:\php\pear...
Il n'arrive pas à trouver le bon chemin est ce que vous savez comment je doit faire?
Image
Cordialement

Re: [PEAR] Problème avec include path sous wamp

Posté : 03 août 2010, 23:29
par stealth35
ton DB.php est dans ton dossier DB
donc
include 'DB/DB.php';

Re: [PEAR] Problème avec include path sous wamp

Posté : 03 août 2010, 23:51
par xTG
Il y a fort à parier que le C: provient d'une mauvaise installation de PEAR.
Pour modifier ces chemins enregistrés (si tu es sûr que tout le reste est correctement installé malgré la base de registre) voici le contenu du .reg à exécuter si tu n'en as pas dans ton dossier PEAR :
REGEDIT4
[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR"
"PHP_PEAR_INSTALL_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR\\pear"
"PHP_PEAR_DOC_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR\\pear\\docs"
"PHP_PEAR_BIN_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR"
"PHP_PEAR_DATA_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR\\pear\\data"
"PHP_PEAR_PHP_BIN"="c:\\wamp\\bin\\php\\php5.2.9-2\\php.exe"
"PHP_PEAR_TEST_DIR"="C:\\wamp\\bin\\php\\php5.2.9-2\\PEAR\\pear\\tests"

Re: [PEAR] Problème avec include path sous wamp

Posté : 04 août 2010, 10:53
par ferv21
Bonjour

Dans le dossier php5.3.0 j'ai le fichier REG PEAR_ENV, je l'ai ouvert avec bloc note
REGEDIT4
[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="E:\\wamp2\\bin\\php\\php5.3.0"
"PHP_PEAR_INSTALL_DIR"="E:\\wamp2\\bin\\php\\php5.3.0\\pear"
"PHP_PEAR_DOC_DIR"="E:\\wamp2\\bin\\php\\php5.3.0\\docs"
"PHP_PEAR_BIN_DIR"="E:\\wamp2\\bin\\php\\php5.3.0"
"PHP_PEAR_DATA_DIR"="E:\\wamp2\\bin\\php\\php5.3.0\\data"
"PHP_PEAR_PHP_BIN"=".\\php.exe"
"PHP_PEAR_TEST_DIR"="E:\\wamp2\\bin\\php\\php5.3.0\\tests"

Donc le chemin pointe bien sur lecteur E, dois je changer?

Re: [PEAR] Problème avec include path sous wamp

Posté : 04 août 2010, 10:58
par xTG
Dans ce cas exécutes ce .reg il te mettra les bonnes valeurs dans la base de registre.
Celles que tu as actuellement doivent provenir de l'installation.

Re: [PEAR] Problème avec include path sous wamp

Posté : 04 août 2010, 13:16
par ferv21
C'est fait le problème persiste

Re: [PEAR] Problème avec include path sous wamp

Posté : 04 août 2010, 13:30
par stealth35
c'est ca qui faut mettre dans ton include_path

Code : Tout sélectionner

E:\wamp2\bin\php\php5.3.0\pear
et faire
include 'DB/DB.php'