Home  >  Article  >  Backend Development  >  How to install pecl extension in php

How to install pecl extension in php

藏色散人
藏色散人Original
2020-07-24 11:00:005525browse

How to install pecl extension in php: First open the terminal command window; then enter and execute the command "sudo yum install php-dev php-pear autoconf, automake, libtool -y" to install pecl.

How to install pecl extension in php

Pecl's full name is The PHP Extension Community Library, a PHP community extension library, written and maintained by the community. The convenience of using pecl is that we don’t need to search for source code packages to download, compile and configure. We don’t need to manually phpize, configure, make, make install. The module installation path is automatically identified. We only need to edit the php.ini configuration file to enable the extension. Of course, we also need When configuring some parameters yourself, you can download the source code first and then build it

Recommended: "PHP Tutorial"

Install pecl

Apt

➜ sudo apt-get install php-dev php-pear autoconf,automake,libtool  -y

Yum

➜ sudo yum install php-dev php-pear autoconf,automake,libtool  -y

pecl common commands

build                  从C的源码中构建扩展
install                安装一个包,步骤包含(configure,make,make install)
download               下载源码包
list-all               列出全部包
run-tests              运行测试(make test)

pecl --help

Install MongoDB extension

➜ sudo pecl install mongodb

Configure PHP.ini

Redhat

extension=mongodb.so

Debian/Ubuntu

sudo vim  /etc/php/7.0/mods-available/mongodb.ini
; configuration for php mongodb module
; priority=20
extension=mongodb.so

Zend extension

zend_extension=opcache.so
➜ sudo phpenmod mongodb

Confirm whether the installation is successful

➜ php -m | grep mongodb
mongodb

The above is the detailed content of How to install pecl extension in php. 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