My PEAR: The Beginning - Installing PEAR
(Page 2 of 4 )
Installing PEAR is very easy. I find that it is a bit more complicated to find a particular package for a project than to actually install PEAR. The first place to look when searching for a package is the PEAR home page at http://pear.php.net/
The PEAR package manager is bundled with all modern versions of PHP. Linux and Unix users do not explicitly have to install Package Manager as it is automatically installed. Windows users, however, have to go through the following steps (this guide assumes that you have installed php in c:php):
the following welcome message should then appear on the screen:
Welcome to go-pear
After the welcome screen, simply follow the instructions and all the currently available packages will be downloaded and installed.
Now you are ready to use the Package Manager. The Package Manager is usually run from the command prompt or command shell. Provided you are the administrator or root, you should not have any problems operating the Package Manager. It has a lot of commands:
- Install
- Uninstall
- Channel-add
- Channel-alias
- Channel-info
- Channel-delete
- Channel-update
- List
- List-all
- Login
- Logout
- Makerpm
- Package
- Package-dependencies
and so forth.
There are many more commands that you can use with Package Manager. The ones that we are interested in at this stage are install, uninstall and upgrade. Here's the syntax:
pear install component_name
pear uninstall component_name
pear upgrade component_name
Ensure that you enter the component name as it is; in other words, make sure to keep any capitalization, spacing and underscores intact. If everything went okay, you should get an "install ok" response. This means that the package has been installed successfully.
A common error message that you will often encounter when installing packages will say something about a package having been deprecated. Don't worry about it. Some packages were written for PHP 4 and sometimes these packages contain syntax that PHP 5 just does not understand, so just ignore them.
Later on we will install and test packages.
Next: PEAR Coding Standards >>
More PEAR Articles Articles
More By David Web