1 windows系统安装pecl
1.1 把PHP设置为全局变量
https://jingyan.baidu.com/article/046a7b3ee24964b8c27fa98f.html
在cmd命令框中输入sysdm.cpl回车,就到了系统属性框,然后点击高级下的环境变量。
sysdm.cpl
我的地址是:D:\phpstudy_pro\Extensions\php\php7.3.4nts\
别忘了最后加一个 斜杠 \
1.2 检查是否配置成功
关闭你的终端,然后重新再打开
输入代码
php -v
如果能显示版本号,说明已经配置成功
1.3 检查pecl是否安装成功
在终端输入代码
pecl version
见到以上界面,说明没有安装
1.4 安装 pecl
1.4.1 下载go-pear.phar
https://pear.php.net/go-pear.phar
ctrl+s 重命名为 go-pear.phar,然后在目录 D:\phpstudy_pro\Extensions\php\php7.3.4nts\ 下新建一个文件夹pear 把这个文件复制进去
1.4.2 安装
打开终端
cd D:\phpstudy_pro\Extensions\php\php7.3.4nts\pear
php go-pear.phar
local
yes
13
输入13后弹出对话框选择php.exe所在的目录
看到 1-13, 'all' or Enter to continue:后回车
Would you like to alter php.ini <D:\phpstudy_pro\Extensions\php\php7.3.4nts\php.ini>? [Y/n] : y
Y
输入y
输入回车,就安装完成了
打开你的安装目录 D:\phpstudy_pro\Extensions\php\php7.3.4nts\pear
找到.bat后缀的文件,右键以管理员身份运行
最后将pear文件夹也加入全局变量 (跟1.1一样)
然后重新打开一个终端。
输入
pecl -v
看到以下界面说明已经配置成功
2 安装pecl扩展 big_int(失败)
2.1 以管理员身份运行终端,输入安装命令
pecl install big_int
2.2 如果报错 Connection to `ssl://pecl.php.net:443‘ failed
打开你的vpn 你被墙了 我打开vpn就好了
2.3 还是报错
downloading big_int-1.0.7.tgz ... Starting to download big_int-1.0.7.tgz (48,248 bytes) .............done: 48,248 bytes 37 source files, building WARNING: php_bin D:\phpstudy_pro\Extensions\php\php7.3.4nts\php-cgi.exe appears to have a suffix -cgi.exe, but config variable php_suffix does not match ERROR: The DSP big_int.dsp does not exist.
没有找到解决办法
2.4 其他安装方法
https://www.php.net/manual/zh/install.pecl.windows.php
2.4.1 直接下载dll
https://pecl.php.net/package/mongodb
找到蓝色的DLL
选择你的版本
phpinfo();
查看Architecture
查看PHP Extension Build
我的php版本是7.3.4
,x64
的64位系统,运行方式为NTS
,也就是非线程安全版。因此,在这里,我选择7.3 Non Thread Safe (NTS) x64
。
把dll后缀的这个文件 复制到 D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext 文件夹即可
2.4.2 手动编译成php文件(放弃了)
我不会
3 其他参考链接
3.1其他系统安装
https://www.php.net/manual/zh/install.pecl.php
https://blog.csdn.net/tombosky/article/details/133989509
3.1 PECL扩展包下载地址
https://pecl.php.net/package-stats.php