An Introduction to PEAR
Pages: 1, 2
Installing PHP from CVS
If you have never heard of CVS, take a look at the related documentation. It is not a difficult technology to use, but it takes a while to become comfortable with it.
Assuming you already have the standard CVS client installed correctly on your machine, you will need to follow these steps:
1. Open a terminal window (rxvt, xterm, or whatever)
2. Type the following commands:
cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository login [Enter
Password:phpfi as the password here]
cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php4
[This will create a new directory named php4]
cd php4 [Enter
cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository login
Password:zend as the password here]
cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository co Zend TSRM
[This will create two new directories under "php4", named "Zend" and "TSRM"]
./buildconf
That was it. Running buildconf should create the standard configure script that can be used to set your options for PHP. In a normal installation, PEAR should be installed automatically under /usr/local/lib/php, but you can still build the files manually by going into php4/pear and running make install-su as a superuser.
Besides that, you should add the PEAR root directory to the include_path found in your php.ini file. The default path should be /usr/local/lib/php, but it may be elsewhere if you did some manual changes to your configure options.
Starting up with PEAR
PEAR packages can range from database abstraction layers to output cache systems, so PEAR is much more than a simple library -- it is a new standard of writing portable and clean PHP code. One of the most important things for a PEAR newcomer to do is to read the coding standards that are published in the PHP manual.
I'll give some tips on how to start working with PEAR::DB, because it is one of the most popular PEAR packages. You can get examples and help on how to use PEAR::DB by following these steps:
- Search MARC under PEAR-DEV or PEAR-GENERAL for answers to your questions.
- Read the unit-test scripts provided with the source code of PEAR. The location of these scripts can be found in the directory where your PHP CVS source is. In my case, it was
/home/jpm/php4/pear/DB/tests/. - Go through Tomas Cox's excellent PEAR::DB tutorial.
I hope this article has shed some light on the semi-mysterious PEAR library, and that it has provided you with some useful background information on one of the more promising developments in the PHP community.
Enjoy!
Joao Prado Maia is a web developer living in Houston with more than four years of experience developing web-based applications and loves learning new technologies and programming languages.
Return to the PHP DevCenter.
-
how to locate DB.php
2007-09-21 07:34:52 callmahais [View]
- Trackback from http://www.sleepyheadcity.com/awake/blog/archives/000160.html
Tips for Bloggers
2004-03-26 14:11:48 [View]
-
how can I tell if PEAR is installed?
2001-08-29 08:42:13 ziatroyano [View]
-
A little correction in the example
2001-06-23 04:01:09 tvvcox [View]