加入收藏 | 设为首页 | 会员中心 | 我要投稿 通辽站长网 (https://www.0475zz.com/)- 图像处理、建站、语音技术、AI行业应用、媒体智能!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

mac下pecl的扩展如何部署

发布时间:2023-07-11 10:31:38 所属栏目:PHP教程 来源:未知
导读:   这篇文章主要介绍“mac下pecl的扩展如何配置”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“mac下pecl的扩展如何配置&rdq
  这篇文章主要介绍“mac下pecl的扩展如何配置”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“mac下pecl的扩展如何配置”文章能帮助大家解决问题。
 

  mac 下 pecl 的 扩展配置 ( 基于php7.4 )
 
  环境确认
 
  如果你的php是通过brew安装的,一般情况下是带了pecl的。
 
  $ pecl version
 
  PEAR Version: 1.10.13
 
  PHP Version: 7.4.28
 
  Zend Engine Version: 3.4.0
 
  如果没有,可以通过以下脚本安装。
 
  安装脚本
 
  $ curl -O https://pear.php.net/go-pear.phar
 
  $ sudo php -d detect_unicode=0 go-pear.phar
 
  pecl配置
 
  查看pecl的相关配置
 
  $ pecl config-show
 
  这里可以看到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
 
  到扩展目录看以下
 
  /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
 
  很明显 安装扩展.so文件的目录是 /opt/homebrew/Cellar/php@7.4/7.4.28_1/pecl,此目录实际上是软链接到了 /opt/homebrew/lib/php/pecl 。
 
  目录配置
 
  查看php的扩展目录
 
  $ php -i | grep extension_dir
 
  extension_dir => /opt/homebrew/lib/php/pecl/20190902
 
  比如我安装了一个 yaml.so 扩展。
 
  直接在 /opt/homebrew/etc/php/7.4/php.ini 中添加一行 yaml.so,会自动在
 
  /opt/homebrew/lib/php/pecl/20190902/yaml.so 找到软连接到 /opt/homebrew/Cellar/php@7.4/7.4.28_1/pecl/20190902/yaml.so 的原始扩展。
 

(编辑:通辽站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章