Tag Archive for 'how-to'

24
Apr

Setting up PEAR on a Linux web server (CentOS)

Installing pear lets you take advantages of some really interesting way to extend PHP. This should be a fairly simple install, so we hope this helps.

First shell into your machine. This is a personal preference, but if you don’t have an “installs” directory, your home directory can get messy. Let’s cd into it.

% cd installs

Now get the pear code:

% wget http://pear.php.net/go-pear

What? No wget? Install wget and come back.

The following is at the top of the file that wget just downloaded, but they don’t seem to mention it, so we will. Just run this file as a php script from the command line.

% php -q go-pear

The only thing you need to change is the install path. The default is where you are now. Use /usr/local.

For some reason the default looks like this:

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation prefix ($prefix) : /Users/mlavista
2. Temporary files directory     : $prefix/temp
3. Binaries directory            : $prefix/bin
4. PHP code directory ($php_dir) : $prefix/PEAR
5. Documentation base directory  : $php_dir/docs
6. Data base directory           : $php_dir/data
7. Tests base directory          : $php_dir/tests

1-7, 'all' or Enter to continue:

Type “1″ to change the path. Go with /usr/local/ and hit enter

The rest is all defaults and let it install.

To test, when you’re done check to see if it’s in your path:

% which pear

You should be all set. To install something

% pear install NAME_OF_MODULE