Mac php安装pear并使用pecl安装php拓展

本文介绍了如何在Mac上通过curl下载并安装PEAR,详细步骤包括设置安装路径和二进制目录。接着讲解了PECL的用途,它是PHP的C语言扩展库。最后演示了如何使用PECL安装xdebug扩展。按照教程操作,可以成功在Macphp环境中配置PEAR和安装PHP拓展。
摘要由CSDN通过智能技术生成

Mac php安装pear使用pecl安装php拓展

Pear

PEAR(PHP Extension and Application Repository)即php拓展和应用仓库

PEAR将php开发过程中常见的功能编写成类库,如网络协议,文件操作,数据操作,缓存操作等许多其他常用功能,用户可通过这些类库进行适当的开发已达到开发的目的,避免了用户重复造轮子的工作。大大提高了Php程序开发的效率和开发质量

PECL(PHP Extension Community Library)php扩展库

PECL可以看作是PEAR的一部分,提供了PEAR类似的功能。不同的是PEAR所有的拓展都是用纯php代码编写,而PECL使用C语言开发的。前者可直接将扩展的代码包含到自己的php项目中使用,而后者需要编译后才能使用。

一顿百度之后,发现都是复制黏贴,并没有解决我的问题。本文将引用官网的教程加以说明。 末尾会附上官方说明

通过curl下载pear

curl -O https://pear.php.net/go-pear.phar

安装

php -d detect_unicode=0 go-pear.phar

考虑到权限问题还是加上sudo比较稳

sudo php -d detect_unicode=0 go-pear.phar

接下来按顺序依次是

1:输入 1 回车

2:输入 /usr/local/pear 回车

3:输入 4 回车

4:输入 /usr/local/bin 回车

5:继续回车

以下是官方说明

Use curl as shown below to download the go-pear.phar file or just download the go-pear.phar file via your browser.

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

​ You’re now ready to configure PEAR for installation.

​ First you need to change the Installation Base.

  1. ​ So type 1, and then press Enter.
  2. ​ Enter /usr/local/pear
  3. ​ Press Enter.

​ Then, you will need to change the Binaries directory.

  1. ​ Type 4, and then press Enter.
  2. ​ Enter /usr/local/bin
  3. ​ Press Enter.

​ Once you have changed the Installation Base and the Binaries Directory, press Enter to install PEAR.

​ For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.

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


使用pecl安装 xdebug扩展

arch -x86_64 sudo pecl install xdebug
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

冯伪猿

觉得文章不错?打赏支持一下吧。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值