PEAR

This is a discussion on PEAR within the PHP forums, part of the Development category; Hiya guys, I'm trying to install PEAR to use it's Mail feature (trying to move away from PHP 's mail() ...


Reply
 
LinkBack Thread Tools Display Modes
Old 16th February 2010, 02:07 PM   #1
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Location: Spain
Posts: 329
Thanks: 24
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Default PEAR

Hiya guys,

I'm trying to install PEAR to use it's Mail feature (trying to move away from PHP's mail() function).

However, for some reason it doesn't seem to be recognising my include path to the pear directory. I've been following the instructions at: Manual :: Checking if PEAR works, and have got to the end, running the simple code:

PHP Code:
require_once 'System.php'
But php is throwing back the error:

Code:
[Tue Feb 16 14:59:52 2010] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'System.php' (include_path='.:/usr/share/pear/') in test.php on line 2
As you can see, my php.ini file recognises that /usr/share/pear/ is a directory to look for System.php. The /usr/share/pear/ directory exists, as does the System.php file inside.

Anyone have any ideas what might be going wrong here?

Thanks!

Stu
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 17th February 2010, 02:46 PM   #2
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Location: Spain
Posts: 329
Thanks: 24
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Default

Hi All,

This probably should have gone in server management, but never mind lol...

On the upside I found a solution just in case anyone stumbles across this post in the future.

Adding:

Code:
/usr/share/pear
as a value for 'include_path' in php.ini didn't work for some reason, but I'm convinced it should!

However, adding the following to the domains vhost.conf (located at: /var/www/vhosts/<my domain>/conf/vhost.conf) file did the trick:

Code:
<Directory /var/www/vhosts/<my domain>/httpdocs>
        php_admin_value include_path "/var/www/vhosts/<my domain>/httpdocs/:/usr/share/pear/"
        php_admin_value open_basedir "none"
</Directory>
Where <my domain> is the domain you want to enable pear for. A good little guide about it is: How To Enable PEAR Packages In Plesk ~ Mattias Geniar

Stu
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 17th February 2010, 03:09 PM   #3
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Location: Spain
Posts: 329
Thanks: 24
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Default

Cancel that.. well edit it slightly!

The code above:
Code:
<Directory /var/www/vhosts/<my domain>/httpdocs>
        php_admin_value include_path "/var/www/vhosts/<my domain>/httpdocs/:/usr/share/pear/"
        php_admin_value open_basedir "none"
</Directory>
Meant that all files would call includes from the base directoy (i.e www.mydomain.com/), and not the directory you specified.

For example, if you had a file in a directory named 'foobar': www.mydomain.com/foobar/foo.php, and this file had a line to call another file (in the same directory), e.g:
PHP Code:
include 'bar.php'
This line wouldn't call the file www.mydomain.com/foobar/bar.php, it would try to call www.mydomain.com/bar.php, which probably doesn't exist!

So a little alteration to vhost.conf and all files in any directory work like clockwork:
Code:
<Directory /var/www/vhosts/<my domain>/httpdocs>
        php_admin_value include_path ".:/usr/share/pear/"
        php_admin_value open_basedir "none"
</Directory>
I'll stop my wittering now lol
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 24th February 2010, 07:55 AM   #4
admin
 
WelshStew's Avatar
 
Join Date: Dec 2008
Posts: 1,844
Blog Entries: 3
Thanks: 13
Thanked 36 Times in 34 Posts
WelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond reputeWelshStew has a reputation beyond repute
Expertise: (X)HTML / CSS
Experience: Professional
Default

Thanks for letting us know Stu.
WelshStew is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 2nd April 2010, 09:33 AM   #5
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Location: Spain
Posts: 329
Thanks: 24
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Default

Ok, me again lol

Just come back to this to do it on a new server for a new client (I had obviously forgotten how to since I last did it!). And I should mention for anyone else that finds this (most likely me again in a years time! lol), that you will need to reconfigure the host to actually look for the new vhost.conf file if it wasn't there already. So once you have done all the above, run:

Code:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<my domain>
Then restart apache.

Simple! lol
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Reply

Tags
pear

Thread Tools
Display Modes