Home > Article > Backend Development > An example of how to install extensions in PHP via pecl
The following editor will share with you an article about PHP through pecl methodInstallationExtensionExample explanation, which has a good reference and value for learning PHP. I hope it will be useful to everyone. help. Friends who are interested in PHP, please follow the editor to take a look
1. Install pecl and create shortcut keys (if you have installed PHP, you can ignore this installation step)
# cd /usr/local/php/bin/ //可查看是否已带有pecl # wget http://pear.php.net/go-pear.phar -O go-pear.php # php go-pear.php # ln -s /usr/local/php /bin/pecl /usr/bin/pecl
2. Querywhether the extension has been included
# pecl search swoole // swoole为要查询扩展名(以swoole扩展为例) //查询结果: Retrieving data...0% .Matched packages, channel pecl.php.net: ======================================= Package Stable/(Latest) Local swoole 1.9.23 (stable) Event-driven asynchronous and concurrent networking engine with high performance for PHP. swoole_serialize 0.1.1 (beta) the fastest and smallest serialize fucntion bound for php7
3. Install configuration extension
# pecl install swoole //输出结果: Build process completed successfully Installing '/usr/lib64/php/modules/swoole.so' install ok: channel://pecl.php.net/swoole-1.9.23 configuration option "php_ini" is not set to php.ini location You should add "extension=swoole.so" to php.ini # 配置php.ini引用swoole.so然后重启php即可
Note: Compared with phpize installation, pecl installation is simpler and can be Eliminate the need to manually add it to php.ini
Related recommendations:
What is pecl? How to install pecl under centos?
PECL for PHP extension installation
Quickly install the php-memcached extension through pecl
The above is the detailed content of An example of how to install extensions in PHP via pecl. For more information, please follow other related articles on the PHP Chinese website!