Home >Backend Development >PHP Problem >How to install extensions in php through pecl?

How to install extensions in php through pecl?

coldplay.xixi
coldplay.xixiOriginal
2020-07-21 13:07:483733browse

php method to install extensions through pecl: first install pecl and install php extensions; then query related extensions, the code is [[root@localhost src]# pecl search swoole]; finally install the relevant extensions .

How to install extensions in php through pecl?

How to install extensions via pecl:

1. Install pecl

cd /usr/local/php/bin/
wget http://pear.php.net/go-pear.phar -O go-pear.php
php go-pear.php
##回车默认安装

2. Install php extension

pecl search key-word    #用于查找扩展
pecl install key-word   #用于安装扩展

3. Query related extensions

[root@localhost src]# pecl search swoole
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
swoole  1.8.12 (stable) 1.8.12 Event-driven asynchronous and concurrent networking engine with high performance for PHP.
[root@localhost src]# pecl search xdebug
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
xdebug  2.4.1 (stable)        Provides functions for function traces and profiling

4. Install related extensions

pecl install xdebug
##安装完成之后,输出
Build process completed successfully
Installing '/usr/lib64/php/modules/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.4.1
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib64/php/modules/xdebug.so" to php.ini
##根据提示,我们在php.ini的最后添加
zend_extension=/usr/lib64/php/modules/xdebug.so
pecl install swoole

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of How to install extensions in php through pecl?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn