Home >Backend Development >PHP7 >Detailed explanation of the extended configuration of pecl under mac (with code examples)

Detailed explanation of the extended configuration of pecl under mac (with code examples)

藏色散人
藏色散人forward
2023-03-25 17:51:081242browse

This article brings you relevant knowledge about PHP. It mainly introduces to you the extended configuration of pecl under mac. This article is based on php7.4. Interested friends can take a look at it together. I hope Helpful to everyone.

Detailed explanation of the extended configuration of pecl under mac (with code examples)

Extended configuration of pecl under mac (based on php7.4)

Environment confirmation

If your php is installed through brew, pecl is usually included.

$ pecl version
PEAR Version: 1.10.13
PHP Version: 7.4.28
Zend Engine Version: 3.4.0

If not, you can install it through the following script.

Installation script

$ curl -O https://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

pecl configuration

View pecl related configuration

$ pecl config-show

You can see it here Go to the default extension directory of pecl

PEAR executables directory     bin_dir          /opt/homebrew/lib/php/pecl/bin
PEAR documentation directory   doc_dir          /opt/homebrew/share/pear@7.4/doc
PHP extension directory        ext_dir          /opt/homebrew/Cellar/php@7.4/7.4.28_1/lib/php/20190902PEAR directory                 php_dir          /opt/homebrew/share/pear@7.4PEAR Installer cache directory cache_dir        /private/tmp/pear/cache
PEAR configuration file        cfg_dir          /opt/homebrew/lib/php/pecl/cfg

Go to the extension directory and see the following

/opt/homebrew/Cellar/php@7.4/7.4.28_1/ [master*] ls -all | grep pecl
lrwxr-xr-x   1 yuan  admin      26  3 30 20:21 pecl -> /opt/homebrew/lib/php/pecl

It is obvious that the directory where the extension .so file is installed is/opt/homebrew/Cellar/php@7.4/7.4 .28_1/pecl, this directory is actually a soft link to /opt/homebrew/lib/php/pecl.

Directory configuration

View the php extension directory

$ php -i | grep extension_dir
extension_dir => /opt/homebrew/lib/php/pecl/20190902

For example, I installed a yaml.so extension.
Add a line yaml.so directly to /opt/homebrew/etc/php/7.4/php.ini, it will automatically be added to
/opt/ homebrew/lib/php/pecl/20190902/yaml.so Find the original soft connection to /opt/homebrew/Cellar/php@7.4/7.4.28_1/pecl/20190902/yaml.so Extension.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Detailed explanation of the extended configuration of pecl under mac (with code examples). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete