PECL / PEAR confusion (with memcache)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All,

I'm really having a hard time making sense of PECL and PEAR. My understanding is that PECL is for PHP extensions (written in C using the extension API) and that PEAR is a repository of PHP modules (classes written in PHP using the PEAR-approved "framework").

PEAR VS PECL COMMANDS

On my linux box, I find two separate commands:

   * /usr/bin/pear
   * /usr/bin/pecl

But these are actually shell scripts which just invoke PHP on the following files:

   * php ... /usr/lib/php/pearcmd.php
   * php ... /usr/lib/php/peclcmd.php

But, when I dig even further, it looks like 'peclcmd.php' is just a wrapper around 'pearcmd.php' and the only thing that is different is the one-line define:

   * define('PEAR_RUNTYPE', 'pecl');

So, basically at this point, everything is using the same script and a small flag toggles the behavior. OK, that's fine.
SEARCH FOR MEMCACHE

I'm looking at an extension 'memcache' that I want to install. So I see if there is either a class (PEAR) or and extension (PECL), right?

   * pear search memcache
     Retrieving data...0%....50%....no packages found that match
     pattern "memcache"

   * pecl search memcache
     Retrieving data...0%....50%....Matched packages, channel pecl.php.net:
     =======================================
     Package  Stable/(Latest)      Local
     memcache 2.0.1/(2.0.1 stable)       memcached extension

So there's a PECL extension, but not a PEAR module. That's fine.

INSTALL MEMCACHE

   * pear install memcache
     No releases available for package "pear.php.net/memcache" -
     package pecl/memcache can be installed with "pecl install memcache"
     Cannot initialize 'memcache', invalid or missing package file
     Package "memcache" is not valid
     install failed

Right, I can't 'pear' install because this is a PECL thing, not a 'pear' thing. Got it.

   * pecl install memcache
     ...
     install ok: channel://pear.php.net/memcache-2.0.1

Ok, that a little bit confusing because I did a PECL install, not a pear install, but maybe pear and pecl both share the same domain name. I'll ignore seeing pear in that URL, moving on...

CHECKING THAT IT'S INSTALLED

   * pecl list
     (no packages installed from channel pecl.php.net)

What? I JUST installed it, why isn't it in my list? Hmmm... I have another idea:

   * pear list
     Installed packages, channel pear.php.net:
     =========================================
     Package         Version State
     Archive_Tar     1.3.1   stable
     Console_Getargs 1.3.1   stable
     Console_Getopt  1.2     stable
     PEAR            1.4.6   stable
     memcache        2.0.1   stable

Huh? I see my 'memcache' thing in the 'pear' list but not in the 'pecl' list. So, did I install a PEAR thing or a PECL thing before? This is weird. Let's go look at the file system:

   * find /usr/lib/php -name 'memcache*'
     /usr/lib/php/.registry/memcache.reg
     /usr/lib/php/extensions/no-debug-non-zts-20050922/memcache.so
     /usr/lib/php/doc/memcache

Well, it looks like memcache was installed successfully as a linux .so (shared object), so it must be a pecl extension. No idea why it shows up in the PEAR list and not the PECL list. I'm thinking it might have something to do with that URL. Any insights you can provide?

Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux