I am developing a script for a site using php and I want to use some PEAR classes as they are very helpful to save me from some repeated tasks.
The Problem is that I have to deliver the project as a standalone folder that will be placed in an existing website without depending on any server configuration other than PHP 5 and MySQL.
So I am looking for an easy way to do that. Can any one help?
You can download the packages (be sure do download any dependencies as well), and put them into a directory. Then, in php, adjust the include path to include that directory:
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mypear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
Then, you can use pear just like normal (include Mail.php;
)...
You want to use the Pyrus installer: http://pear2.php.net/
It allows you to do this exact thing, multiple PEAR package installs in different locations.
$>php pyrus.phar install /Path/to/project/lib pear/Net_URL
where lib is a directory within your project. The main issue I ran into is while the docs say it's for 5.3+ you need 5.3.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With