tags:

views:

161

answers:

2

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

+2  A: 

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.

Pascal MARTIN
I see so If I wasn't trying to get PEAR then on most host I won't just "have" it, that's what I was trying to find out. With xampp for windows it seems to have pear and a bunch of classes in the pear folder so I wasn't sure if they were possibly part of php itself
jasondavis
Depending on your hosting service, it is indeed possible that some PEAR classes might not be available, or only old versions, or any bad surprise like that ;; if you really depend on some package, you can include it in your project, though, adapting the include_path so the packages included in your project are found ;; see also : http://pear.php.net/manual/en/installation.shared.php
Pascal MARTIN
A: 

For Windows, at least, PHP does not ship with PEAR (PHP Extension and Application Repository). There is, though, a go-pear.bat executable script in the root of the PHP installation which you should run in order to install PEAR.

The classes you see on php.net are most likely not part of the PEAR package. PEAR classes are written in pure PHP, while classes present in the main documentation on php.net are written in C.

Ionuț G. Stan