PHP PEAR DB module not working?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mpar612

    PHP PEAR DB module not working?

    I am stumped. Below is my code and it doesn't work (I removed the
    $login info for posting).

    PHP Code:
    require 'PEAR/DB.php';

    // Connect to the database
    $db = DB::connect($lo gin);
    if (DB::isError($d b)) { die ("Can't connect: " . $db->getMessage() ); }

    // Set up automatic error handling
    $db->setErrorHandli ng(PEAR_ERROR_D IE);

    // Set up fetch mode: rows as objects
    $db->setFetchMode(D B_FETCHMODE_ASS OC);

    if (class_exists(' DB')) {

    print "ok";

    } else {

    print "failed";

    }

    However, this code does:

    PHP Code:
    require 'PEAR/DB.php';

    if (class_exists(' DB')) {

    print "ok";

    } else {

    print "failed";

    }

    I just switched ISP's and none of the stuff that utilizes PEAR works
    on the new ISP. PEAR is installed. The DB module is installed, but I
    can't connect to a database. I don't get any errors. I just get a
    blank screen.

    Any thoughts would be greatly appreciated. Thanks!

  • Mike P2

    #2
    Re: PHP PEAR DB module not working?

    On May 1, 9:05 am, mpar612 <mpar...@gmail. comwrote:
    I am stumped. Below is my code and it doesn't work (I removed the
    $login info for posting).
    >
    [...]
    >
    I just switched ISP's and none of the stuff that utilizes PEAR works
    on the new ISP. PEAR is installed. The DB module is installed, but I
    can't connect to a database. I don't get any errors. I just get a
    blank screen.
    >
    Any thoughts would be greatly appreciated. Thanks!
    Where in the code does the error occur? What is the error message you
    get?

    Comment

    • mpar612

      #3
      Re: PHP PEAR DB module not working?

      On May 1, 5:01 pm, Mike P2 <sumguyovrt...@ gmail.comwrote:
      On May 1, 9:05 am, mpar612 <mpar...@gmail. comwrote:
      >
      I am stumped. Below is my code and it doesn't work (I removed the
      $login info for posting).
      >
      [...]
      >
      I just switched ISP's and none of the stuff that utilizes PEAR works
      on the new ISP. PEAR is installed. The DB module is installed, but I
      can't connect to a database. I don't get any errors. I just get a
      blank screen.
      >
      Any thoughts would be greatly appreciated. Thanks!
      >
      Where in the code does the error occur? What is the error message you
      get?
      I have come a little way since I made the post. I was originally not
      getting any sort of error, but it turned out I had to put a
      display_errors line in my code. Now I get the following errors:

      Warning: main(): open_basedir restriction in effect. File(/usr/share/
      pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/
      ygptechnologies .com/httpdocs:/tmp) in /var/www/vhosts/xxxx.com/
      httpdocs/PEAR/DB.php on line 30

      Warning: main(PEAR.php): failed to open stream: Operation not
      permitted in /var/www/vhosts/xxxx.com/httpdocs/PEAR/DB.php on line 30

      Fatal error: main(): Failed opening required
      'PEAR.php' (include_path=' .:/usr/share/pear:/user/share/pear:') in /
      var/www/vhosts/xxxx.com/httpdocs/PEAR/DB.php on line 30

      I am very new to this sort of stuff and I'm really lost with what to
      do. I think my first step is to modify the php.ini file.

      Any assistance would be great.

      Thanks in advance!

      Comment

      • Mike P2

        #4
        Re: PHP PEAR DB module not working?

        Warning: main(): open_basedir restriction in effect. File(/usr/share/
        pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/
        ygptechnologies .com/httpdocs:/tmp) in /var/www/vhosts/xxxx.com/
        httpdocs/PEAR/DB.php on line 30
        Well, this error message is a pretty good description of the problem.
        Contact your new ISP and give them this message, they will be the best
        ones to fix the problem.

        -Mike PII

        Comment

        Working...