How to use a pear without installation

I am developing a script for a site using php, and I want to use some PEAR classes, since they help a lot to save me from some repetitive tasks.

The problem is that I have to provide the project as a separate folder that will be hosted on an existing website, depending on the server configuration other than PHP 5 and MySQL.

So I'm looking for an easy way to do this. Can anyone help?

+4
source share
2 answers

You can download packages (be sure to download any dependencies) and put them in a directory. Then in php edit the include path to include this directory:

$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mypear'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); 

Then you can use the pear as usual ( include Mail.php; ) ...

+5
source

Do you want to use the Pyrus installer: http://pear2.php.net/

This allows you to do this accurately; several PEAR packages are installed in different places.

$> php pyrus.phar install / Path / to / project / lib pear / Net_URL

where lib is the directory in your project. The main problem I ran into is that the docs say that for 5.3+ you need 5.3.1.

+4
source

Source: https://habr.com/ru/post/1311645/


All Articles