Search code examples
phppear

Is PHP PEAR included with php?


I am looking over the php installation on my local PC via Xampp and I notice in the php.ini file for the include directoy, it has includes for unix but PEAR for Windows

include_path = ".:/php/includes"

but for windows it has

include_path = ".;C:\webserver\php\pear\"  

So I am wanting to know, is PEAR included in a default version of PHP? OR is it just an add-on that can be used?

All the special classes you see on php.net are those built into PHP or do they use PEAR as well?

Just trying to find out more about pear, like if it is something I use already without noticing I am using it or if it is something not php standard and I would have to intentionally use it


Solution

  • When compiling PHP from the sources, you have these options :

    $ ./configure --help                                                    
    Usage: configure [options] [host]                                       
    Options: [defaults in brackets after descriptions]
    
    ...
    
    PEAR:
    
      --with-pear=DIR         Install PEAR in DIR [PREFIX/lib/php]
      --without-pear          Do not install PEAR
    
    ...
    

    Which means you can get some kind of PEAR support with a "default" version of PHP ; it'll probably only install the pear program (an probably a few basic packages), though, that will allow you to download/install others packages from the PEAR repository -- or other repositories that support PEAR.


    Still, "installing pear" doesn't mean much by itslef : what you'll use are PEAR packages -- and you'll generally have to install those yourself, using commands like

    pear install package_name
    


    Using the official windows release, from what I remember, you get a "go-pear.bat" batch file ; if you launch it, it will install the pear command, and do some basic configuration, like modify the default include_path so it includes the directory in which the pear command will install PEAR packages.


    All the special classes you see on php.net are those built into PHP or do they use PEAR as well?

    I don't remember having seen any PEAR class in the online manual.

    But I remember having seen PECL extensions in that same manual -- for instance, APC and its manual page.

    The difference being that PEAR packages a sets of classes written in PHP, while PECL extensions are generally written in C, and loaded as... well, php extensions.