Recently I was just installing PEAR and I needed to add it to $PATH. I stumbled upon site of muttsnutts notes and here is the path I’ve been following to do it:
Here is how to install PEAR:
1 2 3
| $ cd /Users/robertkuzma
$ wget http://pear.php.net/go-pear.phar
$ php -d detect_unicode=0 go-pear.phar |
The syntax for adding $PATH:
1
| sudo sh -c 'echo "/Users/robertkuzma/pear/bin" >> /etc/paths.d/pear_path' |
Eventually for PEAR to work in PHP you will also need to add the include line to php.ini file.
1
| include_path=".:/Users/robertkuzma/pear/share/pear" |
And how to check if pear is actually working in your PHP? You have to include System.php class because it comes embeded with PEAR.
1 2 3 4 5 6 7 8 9 10
| <?php
require_once 'System.php';
if(class_exists('System')===true) {
echo 'PEAR is installed!';
} else {
echo 'PEAR is not installed :(';
}
?> |
or a bit more simple:
1 2 3 4 5 6
| <?php
require_once 'System.php';
var_dump(class_exists('System', false));
?> |
Follow Us!