Why to use PEAR

A comment was posted on a tutorial I wrote How to: Install Apache, PHP, PEAR, MySQL & phpMyAdmin for Windows XP. The comment said:

What does PEAR do that can’t be done (otherwise) … Like, I can do all the usual stuff with the database now, so am I missing anything by not installing PEAR? What does PEAR do?

Good questions, hard to answer.  I came up with a few…

1)

I’m from Canada, and believe me, it gets cold up here. When it’s -20 (Celsius), I could go outside wearing a spring jacket, but the smart thing is to put a big winter jacket on. Eventually, it’ll become summer, and there is no need for a winter jacket. But as seasons are cyclical, it will become cold again. PEAR is a lot like that, you can do a lot of PEAR’s features with normal PHP, but as you use PEAR more, you’ll see it’s like wearing a winter jacket (even when you don’t have to). Plus there are so many cool packages available and in the works.

2)

Straight from the PEAR website it says:

PEAR is short for “PHP Extension and Application Repository” and is pronounced just like the fruit. The purpose of PEAR is to provide:

  • A structured library of open-sourced code for PHP users
  • A system for code distribution and package maintenance
  • A standard style for code written in PHP, specified here
  • The PHP Extension Community Library (PECL), see more below
  • A web site, mailing lists and download mirrors to support the PHP/PEAR community

PEAR is a community-driven project with the PEAR Group as the governing body. The project has been founded by Stig S. Bakken in 1999 and quite a lot of people have joined the project since then.

3)

If you’ve ever seen Tommy Boy, you’ll know a classic line by Chris Farley:

I can get a good look at a T-bone steak by sticking my head up a bull’s ass, but I’d rather take a butchers word for it.

Related Articles:

Follow me on Twitter!

Your Ad Here

8 Responses to “Why to use PEAR”

  1. Matt says:

    Sounds well worth taking a longer look at. Thanks for the info George :cD

    Matt

  2. NCBES says:

    I am getting crazy looking around how to install pear extensions in Ubuntu system
    I have PHP 5.0.5 and I would like to install doi library but it results impossible to find PECL extension for Linux. Which is the alternative?

  3. Lydia says:

    I have problem displaying graph in internet explorer using go-pear anyone have the solution to that?

  4. RITGRAD83 says:

    I have installed Apache/2.2.6 (Win32) PHP/5.2.4 on WinXP 32 SP2 and MySQL 5.0.45 and got everything to work including MyPhpAdmin. No problem there.

    Then when I tried to run the sample peartest.php code as shown below:

    require_once ‘DB.php’;
    PEAR::setErrorHandling(PEAR_ERROR_DIE);

    $db_host = ‘localhost’;
    $db_user = ‘root’;
    $db_pass = ‘password’;
    $db_name = ‘dataBase_name’;
    $dsn = “mysql://$db_user:$db_pass@unix+$db_host/$db_name”;

    $db = DB::connect($dsn);
    $db->setFetchMode(DB_FETCHMODE_OBJECT);

    I get no response or a blank page. Notice that I copied the code without making any changes to the user, password, etc. Also notice a reference to unix in the $dsn variable – not changed either. Ran the code and It didn’t give me any error nothing. Yet when I ran another test code with phpinfo(); it produced a page showing the configuration information.

    Any ideas?

    Thanks

    Richard

  5. Vishal says:

    Hi Richard,
    this might help you…
    1. check whether the DB.php file exist in pear dir (current pear support mdb2.php better you upgrade your package)
    2. use connection as you connect to mysql in windows case you might omit the “unix”

    it worked for me

  6. Jim Dunn says:

    Hey George,

    Have you ever used the PEAR Package called “Crypt_GPG”?

    I’ve spend the last 36 hours trying to get it working… and finally realized I needed to enable the proc_open() and proc_close() functions… but now I’m concerned that other users might be able to use those functions maliciously in PHP…

    Do you have any suggestions?
    Thx! :)
    Jim

  7. George A. Papayiannis says:

    Hi Jim,

    I’ve never used that package. Are you using it for Public/Private encryption? You can look at this post I wrote about RSA: http://www.sematopia.com/?p=275

    All the best,
    George

  8. Evgeni says:

    Hello!
    I need help like the guy up here. I installed PEAR, wrote this
    require_once ‘DB.php’;
    PEAR::setErrorHandling(PEAR_ERROR_DIE);

    $db_host = ‘localhost’;
    $db_user = ‘root’;
    $db_pass = ‘password’;
    $db_name = ‘dataBase_name’;
    $dsn = “mysql://$db_user:$db_pass@unix+$db_host/$db_name”;

    $db = DB::connect($dsn);
    $db->setFetchMode(DB_FETCHMODE_OBJECT);

    but browser tells me about Apache HTTP error. No connection to the DB either.
    DB.php is in PEAR dir. I don’t know, what to do.

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>