Results 1 to 6 of 6

Thread: Cannot access PEAR module

  1. #1
    rongoral Guest

    Default Cannot access PEAR module

    I recently installed the PEAR DB module from the CPanel. I see that it should be accessible to my scripts since it did install in the home/my_domain_alias/php directory. The problem is that 'require'-ing the module in my script is returning this error:

    Fatal error: require() [function.require]: Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/my_domain_alias/public_html/phptest/index.php on line 14

    The offending line is:

    require 'DB.php';
    Do I need to modify the include path? Shouldn't this already be done by the PEAR installer? This is not an urgent matter for me, yet, but it certainly is frustrating. Any insight would be greatly appreciated.

    Peace in Christ -
    Last edited by rongoral; February 28th, 2010 at 08:33 PM.

  2. #2


    When you install the PEAR extensions in cPanel they are installed to php directory in your home directory. So the path would be /home/USERNAME/php.

    You could always double check from cPanel, if you go the PHP Pear section, on top of the page you will see:

    Location of Your PHP Extension(s) and Application(s)
    Path: /home/your_username/php


  3. #3
    rongoral Guest


    Thanks for the reply, Max.

    The package has installed. While using CPanel, if I ask it to show the PHP packages installed, DB is listed. If I use an FTP program to look at the "home" directory (the one above the public_html directory), I can see that the PEAR package has been installed in the php directory. It looks as though it has installed correctly. However, my script is not finding it, hence my confusion. It is as though the PHP parser is bypassing this directory. ???

    So, now I'm wondering if I need to alter the include path in some way. I did this, as an experiment early on. But, since I am not a linux admin, I'm not certain I used the correct syntax. Even so, the default include path should be sufficient. Any more ideas?

  4. #4
    rongoral Guest


    So, the "fix" for this is to alter my include path by adding the following php function call to the script:

    While I am glad to be able to fix this problem, it seems that if a PEAR package is installed using the CPanel installer, the include path should be updated automatically. UNLESS, there is a single php.ini file for the server. In such a case, this IS the acceptable alternative since there are security issues with allowing individual sites on a shared server to have their own php.ini files.

    I'm glad to have this answer, but wish I had come upon it a couple days ago.

    Peace -

  5. #5


    Its fine to include the path the way you have done it.

    The way we generally do it is to create a php.ini file in the directory that you'll be using the PEAR extensions with the following line:
    PHP Code:
    include_path ".:/usr/lib/php:/usr/local/lib/php:/home/YOUR_USERNAME/php" 
    Last edited by Max; April 12th, 2010 at 03:34 PM.

  6. #6
    rongoral Guest


    Thanks Max. Now that this is settled, I can get on with porting my PERL code. I appreciate your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts