1

I keep hearing about php extensions, the standard php library, and built in classes. What are the differences? Let me explain what i mean,

http://us3.php.net/manual/en/extensions.membership.php The page is labeled php core extensions but then it mentions that the following classes are not actual extensions. Would it be the standard library? What is php's standard library? are they classes that come with php?

thanks

Vijay Verma
  • 3,660
  • 2
  • 19
  • 27
Exploit
  • 6,278
  • 19
  • 70
  • 103
  • PHP has functions/classes that are always enabled; commonly called "core" extensions. Others can be enabled and disabled, either at compilation of the PHP binary, or by enabling/disabling `extension=` in the `php.ini` so the according `.dll` or `.so` providing that feature is available or not. Browse http://php.net/manual/en/install.windows.extensions.php for a generic explanation. – mario Nov 17 '13 at 03:01
  • possible duplicate of [Locate available (not loaded) PHP extensions](http://stackoverflow.com/questions/12157584/locate-available-not-loaded-php-extensions) – mario Nov 17 '13 at 03:02
  • my question isnt about enabling/disabling extensions. Its more about the extensions that i listed as a link are they call called the spl library? or are they just extensions? And what is the spl library how does it differ. I already use mamp so most of these things come available to me. – Exploit Nov 17 '13 at 03:23
  • `SPL` is one group of classes, they're ordinary core / built-in features, just with a needlessly fancy title (to avoid identifier conflicts). – mario Nov 17 '13 at 03:26
  • So would the reflection class be considered part of spl? Since its listed on the extensions page – Exploit Nov 17 '13 at 03:27
  • Look into the [PHP source tarball](http://php.net/downloads.php) and where each C declaration is located under (`main/` or `ext/standard` or `ext/spl/`). Though that association is otherwise just as irrelevant as the manual denomination. – mario Nov 17 '13 at 03:32

1 Answers1

1

Core

PHP has some functions that are part of PHP no matter what. These are considered to be important to all of PHP. Those are considered Core.

Bundled

Some functions (like BC Math) are those you must choose to have as part of PHP. You can compile it with or without those libraries, allowing you the flexibility to decide what you do and don't need.. You can use a pre-compiled library to add those functions (i.e. in CentOS you can install the package php-bcmath to get BC Math). In Windows, these will be in a separate DLL.

External

Very similar to Bundled except that these functions also rely on programs outside PHP to work (i.e. you can't use MySQL functions without MySQL installed).

PECL

These are completely outside the PHP project (as in the author of the extension is responsible and not the PHP team). They must be compiled against PHP but you don't have to go to great lengths to do this thankfully, since the PEAR system contains a method that will download the project source and compile it. Understand that if you upgrade the PHP Core to a major version (i.e. 5.4 to 5.5) you will have to recompile any PECL libraries you compiled yourself. Some libraries (especially Windows) offer pre-compiled versions as well.

Machavity
  • 30,841
  • 27
  • 92
  • 100