-   Linux - Software (
-   -   How can I use PEAR from its shared directory in apache2? (

3rods 03-08-2011 11:08 AM

How can I use PEAR from its shared directory in apache2?
I'm running the turnkey linux version of joomla and I need to use PHP's mail functionality to send a notification email from a page (separate from joomla content) . PHP's native stuff is rather plain and I find myself needing the functionality of PEAR. So I've installed PEAR via aptitude, but it has installed to /usr/share/php.

So, my question is, how do I include these files from php scripts? Firstly, the files are owned by root, the www-data user doesn't have access. It also appears that the permissions on the files may need to be modified. Some php files don't have the execute flag (shouldn't they)?

I recognize the point of having a centralized location for updates and sharing, so I don't want to just copy the files to my web directory (/var/www).

Symbolic link maybe?


Guttorm 03-09-2011 09:57 AM


No, there is no need to symlink. Pear is a "packaging system" on it's own, so you need to "pear install" stuff after you have installed the pear package with aptitude.


sudo pear install mail
This downloads the mail stuff in /usr/share/php. And PHP has its own include_path which is similar to $PATH in the shell. It looks in many directories when you include/require files. By default, the include_path is ".:/usr/share/php:/usr/share/pear", so this should work:

PHP Code:

require "Mail.php"

3rods 03-10-2011 10:52 PM

I was unaware of the path include directive in the php.ini file. That's what I was missing. Thanks.

All times are GMT -5. The time now is 05:45 AM.