php5 PEAR error on test scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wannabe
    New Member
    • Jun 2007
    • 1

    php5 PEAR error on test scripts

    This is being installed on WindowsXP home edition.

    I am a complete novice at working with php and have just installed apache2_2, php5, mySQL5.0 and phpMyAdmin 2.10.1. After installing all 4 programs following the instructions from http://www.semtopia.com/?p=28 it tells you to create a file called testpear.php to test your pear install when working with MySQL and PHP. The file I was to create contains this information:
    <?php

    require_once 'DB.php';
    PEAR::setErrorH andling(PEAR_ER ROR_DIE);

    $db_host = 'localhost';
    $db_user = 'root';
    $db_pass = 'isnot14me';
    $db_name = 'dataBase_name' ;
    $dsn = "mysql://$db_user;$db_pa ss@unix+$db_hos t/$db_name";
    $db = DB::connect($ds n);
    $db->setFetchMode(D B_FETCHMODE_OBJ ECT);
    ?>

    When I bring it up in a browser these are the errors that I get:
    Warning: require_once(DB .php) [function.requir e-once]: failed to open stream: No such file or directory in C:\webs\test\te stpear.php on line 3

    Fatal error: require_once() [function.requir e]: Failed opening required 'DB.php' (include_path=' .;C:\php\PEAR') in C:\webs\test\te stpear.php on line 3

    Being a novice at this I have no idea what this means and the only real answer I found was in a language I could not understand. Could you please help me out. Normally I would not ask for help but I am on a deadline for a school project and really need to figure this out. Everything else appears to be fine installation and test-wise with the exception of this test.

    Any help you could provide would be appreciated.
    Last edited by wannabe; Jun 5 '07, 10:08 AM. Reason: Forgot format
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    what "require_on ce" does is open a file and places that whole files into the file that is calling it, this is useful when more than one page performs the same task as another page.

    so, in your code u are telling your php script to open another script called DB.php, since u haven't made one it is complaning.

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      Is DB.php in the C:\php\PEAR folder? If not then this is your problem.

      Comment

      Working...