PHP DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


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
Password:
[Enter 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
cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository login
Password:
[Enter 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.


Valuable Online Certification Training

Online Certification for Your Career
Earn a Certificate for Professional Development from the University of Illinois Office of Continuing Education upon completion of each online certificate program.

PHP/SQL Programming Certificate — The PHP/SQL Programming Certificate series is comprised of four courses covering beginning to advanced PHP programming, beginning to advanced database programming using the SQL language, database theory, and integrated Web 2.0 programming using PHP and SQL on the Unix/Linux mySQL platform.

Enroll today!


Sponsored by: