Home > Backend Development > PHP7 > body text

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

藏色散人
Release: 2023-03-25 17:51:08
forward
1190 people have browsed it

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
Copy after login

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
Copy after login

pecl configuration

View pecl related configuration

$ pecl config-show
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template