php使用pecl方式安装扩展操作示例

时间:2022-09-06 09:26:38

本文实例讲述了php使用pecl方式安装扩展操作。分享给大家供大家参考,具体如下:

安装pecl

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

安装php扩展

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

查询相关扩展

?
1
2
3
4
5
6
7
8
9
10
11
12
[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

安装相关扩展

?
1
2
3
4
5
6
7
8
9
10
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

希望本文所述对大家PHP程序设计有所帮助。

原文链接:https://blog.csdn.net/koastal/article/details/52850416