使用pecl命令报错
$ pecl
warning require_once 'Console/Getopt.php';
//报错文件地址
ERROR_PATH/pear/System.php
具体的修复步骤
1.使用 go-pear.php /go-pear.phar 安装 pear
1.go-pear.php
使用条件 php_version <= 5.1.6
curl -o PATH/go-pear.php https://pear.php.net/go-pear //新建go-pear.php
php PATH/go-pear.php
2.go-pear.phar[以此为演示]
使用条件 php_version > 5.1.6
wget http://pear.php.net/go-pear.phar
php go-pear.phar
2.安装pear
$ php go-pear.phar
1. Installation base ($prefix) : /Users/mac/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/mac/pear/bin
5. PHP code directory ($php_dir) : /Users/mac/pear/share/pear
6. Documentation directory : /Users/mac/pear/docs
7. Data directory : /Users/mac/pear/data
8. User-modifiable configuration files directory : /Users/mac/pear/cfg
9. Public Web Files directory : /Users/mac/pear/www
10. System manual pages directory : /Users/mac/pear/man
11. Tests directory : /Users/mac/pear/tests
12. Name of configuration file : /Users/mac/.pearrc
1-12, 'all' or Enter to continue: //选1即可,后续可以选择安装位置
(Use $prefix as a shortcut for '/Users/mac/pear', etc.)
Installation base ($prefix) [/Users/mac/pear] : //在这里输入要安装的位置 INSTALL_PARH
//可能还会出来上述1-12的选项,无需输入,会车即可
Would you like to alter php.ini </usr/local/etc/php/7.1/php.ini>? [Y/n] ://是否要更改php.ini,输入n即可
//一路会车
//成功提示
Thanks for using go-pear!
修改环境变量
INSTALL_PARH/bin 加入环境变量
3.复制新安装的文件
//还记得 我们使用pecl命令时的错误信息吗
warning require_once 'Console/Getopt.php';
ERROR_PATH/pear/System.php
//删除 错误路径下的所有文件
$ cd ERROR_PATH/pear/ && ls
Archive OS PEAR.php System.php pearcmd.php
PEAR Structures XML peclcmd.php Console[这个文件夹可能丢失,存在文件夹也是空文件夹]
rm -rf ./*
//复制新安装的pear文件
$ cp -r INSTALL_PATH/share/pear/ ./
3. 使用 pecl /pear
The End.