PHP extension types and installation methods

Extension type

Low-level extension (based on C language):

Upper extension (based on PHP language):

PECL

# 查找扩展
$ pecl search extname
# 安装扩展
$ pecl install extname
# 卸载扩展
$ pecl uninstall extname

This will download the source code of extname and compile it, and then install extname.so into extension_dir. Then extname.so can be loaded through php.ini.

phpize

The phpize command is used to prepare the compilation environment of the PHP extension library.

$ wget extension.tar.gz
$ tar ...
$ cd php-7.1/extension/extname
$ /usr/local/php/bin/phpize
$ ./configure
$ make
# make install

This will generate extname.so and automatically place it in PHP's extension library directory . You need to adjust php.ini and add extension = extname.so to use this extension library.

PEAR

After downloading the source code on the PEAR website, it can be used after being introduced into the PHP code.

The PEAR extension is now basically abandoned, and most can be replaced with Composer.

Guess you like

Origin www.cnblogs.com/danhuang/p/12724899.html