Documentation

Extensions management

A PHP extension matchs a file with a .so extension. To load it you have to add it to your php.ini. Example:

extension = /home/superman/yaml.so

where /home/superman/yaml.so is the absolute path to your extension.

Warning:

  • some extensions are loaded with the zend_extension directive rather than extension, it is the extension publisher that indicates when this directive has to be used
  • extensions depends of the PHP major version. A .so file compiled for the PHP 5.5 version will not work on the 5.6: it will have to be recompiled.

Following sections indicates how to procure new extensions.

Extensions integrated in PHP

PHP integrates numerous extensions by default, many of them are already preloaded by alwaysdata. To see the full list of available extensions:

$ ls $(php-config --extension-dir)

To see the list of extensions already loaded on your account:

$ grep extension admin/config/php/php.ini

To load a extension already integrated to PHP, you won't have to specify the absolute path, the name is enough. For example:

extension = bcmath.so

From PECL

Numerous extensions are installable via PECL. To install an extension, we suggest to use our ad_install_pecl script. It uploads configures and compiles an extension:

$ ad_install_pecl yaml

The command generates a new .so file in the current directory. You can however do without our script and use the usual commands (phpize,make) if you prefer.

From the publisher website

Some extensions are directly downloadable from the publisher's site in the precompiled form (.so file). If the publisher offers this option, you have to download the Linux 64 bits version. For example:

From distribution packages

Some extensions are complex or impossible to manually compile. It is possible to extract a.so from the Linux distributions packages, for example Debian:

$ wget http://ftp.debian.org/debian/pool/main/m/mapserver/php5-mapscript_7.0.4-1~bpo8+1_amd64.deb
$ dpkg-deb -x php5-mapscript_7.0.4-1~bpo8+1_amd64.deb .


Last updated: 17 June 2019 at 16:08