Web Hosting Forums

Results 1 to 6 of 6

This is a discussion on How to include PEAR Package? in the Hosting Talk & Chit-chat forum
I'm trying to play around and make some use of pear, but I'm a little confused. I installed a package (Pager) through the CPanel's Pear ...

  1. #1
    Loyal Client
    Join Date
    May 2002
    Posts
    4

    How to include PEAR Package?

    I'm trying to play around and make some use of pear, but I'm a little confused. I installed a package (Pager) through the CPanel's Pear Package Manager. It placed the files in /php on my root.

    Everything I've seen says I should be able to just include it by doing

    require_once 'Pager/Pager.php';

    What am I doing wrong? It's something to do with an include_path directive right?

    Fatal error: require_once() [function.require]: Failed opening required 'Pager/Pager.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
    Last edited by ejason; 11-01-2008 at 05:44 PM.
    jason - http://www.salted.org

  2. #2
    Banned
    Join Date
    May 2007
    Location
    JPC
    Posts
    621
    I believe one of our techs has already taken care of your issue in a support ticket. Let us know if you need further assistance.

  3. #3
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,570
    Quote Originally Posted by ejason View Post
    What am I doing wrong? It's something to do with an include_path directive right?

    Fatal error: require_once() [function.require]: Failed opening required 'Pager/Pager.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
    Yep, you need that /php folder on your include path, which is at /home/<your accountname>/php if I understand you correctly.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    The easiest "fix it and forget it" solution to this is to grab a copy of php.ini from your cPanel and put it somewhere in your account (I put mine right in my home directory for easy access, but the location doesn't matter). Edit that file and add your local php path to the list in the line that starts include_path. (Note that PHP checks every path in the list, in order, and includes the first file with the specified name it finds. For that reason I usually put anything I control at the beginning of the list so that I don't have to worry about surprises when someone installs or updates a server-wide version of a package and causes a conflict with my setup.) Finally create or edit a file called .htaccess in your public_html directory and add the following line:

    Code:
    suPHP_ConfigPath /home/USERNAME
    This tells PHP to use your modified php.ini for all requests. It will also trickle down into all of your subdirectories so that you don't need to worry about things being different anywhere in your site. If you put the php.ini file somewhere other than your home directory, adjust the path accordingly. Note that you should provide the path to the directory containing the php.ini file, not the path to the file itself.

    If you ever find you need a custom php.ini for a specific section of your site you can place that new file right in the directory that needs it and then add a new suPHP_ConfigPath directive to an .htaccess file in that directory to override the main one.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  5. #5
    Loyal Client
    Join Date
    May 2002
    Posts
    4
    Thanks for the replies. Yes Howard, the situation was taken care of (extremely quickly) via a support ticket and everything is up and running smoothly. I usually wouldn't put in a ticket for something like this, I try to keep it down to my yearly "I forgot my passwords" ticket. I did a lot of googling and couldn't find much information, mostly just php include hacks.

    For future references for anyone stumbling across this thread, this is how it was fixed. Originally the pear config-get phpdir command returned usr/lib/php as my pear includes directory.

    JPC went in and changed my pear phpdir to /home/ACCOUNT/php

    I updated my php.ini to include the /home/ACCOUNT/php directory as a viable includes directory (Much as Jason explains in the post above).

    Now everything is working just fine. Thanks for the help everyone, really appreciated.
    jason - http://www.salted.org

  6. #6
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,503
    eJason meet Jason: Jason meet eJason.

    This could be fun.
    Good luck

Bookmarks

Posting Permissions

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