PHP – PECL
PECL is the PHP Community Library, available on the Web at http://pecl.php.net/. PECL seeks to extend PHP’s capabilities through low-level language modules which are written in the C programming language and must be integrated directly into the PHP engine(usually through compilation). PECL extensions are distributed as compressed TAR archives and can be installed to any PHP development system either through the manual compile-and-install processor with the PECL installer(included with every PHP distribution).
Installing PECL Extensions
The procedure for installing a PECL extension is differ n UNIX and Windows. To download compile and install a PECL extension on UNIX all in one fell swoop, issue the following command at shell prompt:
1 |
Shell>pecl install extension-name |
The PECL installer will now connect to the PECL server, download the source code, compile it and install it to appropriate location on your system. Fig 12-4 has an example of installing the Zip extension, available from http://pecl.php.net/pacakage/zip.
Alternatively, download the package source code and manually compile it into a loadable PHP module:
1 2 3 4 5 |
shell# cd zip-1.8.10 shell# phpsize shell# ./configure shell# make shell# make install |
This process should generate a loadable PHP module name zip.so and copy it to the PHP extension directory. It will now need to enabled in the php.ini configuration file.
Windows user has a much easier time of it: they need to simply download a precompiled PECL extension, copy it into PHP’s extension directory and then activate the extension in the php.ini configuration file. Precompiled PECL extension for Windows are freely available on the Web, at http//pecl4win.php.net/.
Once the extension has been correctly installed and activated, restart the Web server and check the output of the phpinfo() command. If extension has been correctly installed, phpinfo() will display an entry for the extension as in fig
You can find more information on installing PECL extensions in the PHP manual at www.php.net/manual/install.pecl.php.