SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Accessing PEAR

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accessing PEAR

    Hello,

    I'm hoping to use PEAR to send HTML email but I'm struggling to access it.

    My (shared) server has PEAR installed <edit>actually it says "supported"</edit> and I'm told that the path is:

    /usr/share/pear-php5

    Any idea what I'm meant to include() to get to PEAR's classes.

    Apologies if it's a silly question.

    Cheers,

    Jon

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    The following article may help you out here:
    Getting Started with PEAR - PHP's Low Hanging Fruit
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you know the path to pear dir, then you should just add this to the top of your script:
    $pearDir = '/usr/share/pear-php5';
    set_include_path($pearDir.PATH_SEPARATOR.get_include_path());

    Then you should be able to access pear using normal include_once, for example
    include_once 'Mail/Mime.php' or whatever pear class you need.

    Try it.
    My project: Open source Q&A
    (similar to StackOverflow)
    powered by php+MongoDB
    Source on github, collaborators welcome!

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply, I tried it and got the following error:

    Warning: include_once() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='/usr/share/pear-php5:.:/usr/share/pear-php5') in ...

    Cheers,

    Jon

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So there actually is a folder named "/usr/share/pear-php5"?

    Sorry to ask such a silly question but I havent come across that folder name before, it has always appeared to me as "/usr/share/pear" by default (RHCE, php.ini comments etc).


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
  •