PHP Packages Installing PECL Packages - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript PHP Packages Installing PECL Packages - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript


Post Top Ad

Post Top Ad

Friday, July 19, 2019

PHP Packages Installing PECL Packages

PHP Packages

Installing PECL Packages


You want to install a PECL package; this builds a PHP extension written in C to use inside PHP.


Make sure you have all the necessary extension libraries and then use the bundled installer pecl:

       % pecl install mailparse

To use the extension from PHP, add the appropriate line to your php.ini file:


The frontend process for installing PECL packages is just like installing PEAR packages for code written in PHP. However, the behind-the-scenes tasks are very different. Because PECL extensions are written in C, the installer needs to compile the extension and configure it to work with the installed version of PHP. As a result, at present, you can build PECL packages on Unix machines if you have the necessary development tools installed.

Unlike PHP-based PEAR packages, PECL extensions don’t automatically inform you when you lack a library necessary to compile the extension. Instead, you are responsible for correctly preinstalling these files. If you are having trouble getting a PECL extension to build, check the README file and the other documentation that comes with the package. The installer puts these files inside the docs directory under your PEAR hierarchy.

When you install a PECL extension, the pecl command downloads the distribution file, extracts it, runs phpize to configure the extension for the version of PHP installed on the machine, and then makes and installs the extension. It may also prompt you for the location of libraries:

       % pecl install memcached
       downloading memcached-2.1.0.tgz ...
       Starting to download memcached-2.1.0.tgz (39,095 bytes)
       ..........done: 39,095 bytes
       11 source files, building
       running: phpize
       Configuring for:
       PHP Api Version:             20100412
       Zend Module Api No:      20100525
       Zend Extension Api No: 220100525


       Build complete.


       install ok: channel://
       You should add "" to php.ini

PECL extensions are stored in different places than PEAR packages written in PHP. If you want to run pecl, you must be able to write inside the PHP extensions directory.

Because of this, you may want to install these packages while running as the same user you used to install PHP. Also, check the execute permissions of these files; because most PEAR files aren’t executable, your umask may not provide those executable files with the correct set of permissions.

If you’re running PHP and PECL in a Windows environment, you may prefer to download precompiled DLLs for the PECL extensions you need by browsing the extension’s page.

No comments:

Post a Comment

Post Top Ad