Pear On Xampp

Discussion in 'PHP' started by divyasmk, Sep 12, 2010.

  1. #1
    I want to use pear .I have installed the xampp package..The pear folder is already on C:\xampp\php\PEAR.I had written the following code..

    <?php
    // Include the appropriate PEAR classes
    require_once("DB.php");

    $dsn = array(
    'phptype' => 'mysql',
    'hostspec' => 'localhost',
    'database' => 'emp',
    'username' => 'root',
    'password' => 'mysql'
    );
    $dbh = DB::connect($dsn);

    $stmt = "SELECT id, name FROM examples ORDER BY id";
    $result = $dbh->simpleQuery($stmt, DB_FETCHMODE_ASSOC);
    if ($dbh->numRows($result) > 0) {
    $data = (object) $dbh->fetchRow($result, DB_FETCHMODE_ASSOC);
    echo "id => $data->id<br>\n";
    echo "name => $data->name<br>\n";
    }
    ?>

    It shows an error message like

    Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3

    Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;c\xampp\php\PEAR') in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3


    The Pear path is already included on php.ini file like

    include_path = ".;c\xampp\php\PEAR"


    ...What should I do?Plz help me?
     
    divyasmk, Sep 12, 2010 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    You need a colon after the c? as in C:\
     
    Kaizoku, Sep 13, 2010 IP
  3. divyasmk

    divyasmk Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks...I had tried it by putting semicolon..But it showing same error message...wat to do..
     
    divyasmk, Sep 13, 2010 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    colon not semicolon.
     
    Kaizoku, Sep 13, 2010 IP
  5. divyasmk

    divyasmk Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry ..By mistake .I used colon .But still same error..I also changed the read only permissions of Pear folder.
     
    divyasmk, Sep 13, 2010 IP
  6. divyasmk

    divyasmk Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Its still not working???Any one plz help me.....
     
    divyasmk, Sep 19, 2010 IP
  7. almedajohnson

    almedajohnson Peon

    Messages:
    140
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think there is some problem in path specification. Have you checked all the folders?? all these paths are correct??
     
    almedajohnson, Sep 19, 2010 IP