您的位置:首页 > 编程语言 > PHP开发

php安装pear

2016-11-25 22:50 253 查看

php安装pear

摘要

按照php pear,下载 go-pear.phar 的时候,不应该直接打开下载链接然后复制代码保存到文件中,而应该直接下载文件,比如“将链接另存为”。

go-pear.phar乱码错误

wamp64 上按照 pear。

pear官方安装文档上这么说

After you have downloaded and installed PHP, you have to manually execute the batch file located in e.g. c:\php\go-pear.bat. Alternatively,

download https://pear.php.net/go-pear.phar with your browser and save the output to a local file named go-pear.phar. You can then run

php go-pear.phar

据此执行后,CMD出现错误信息:

Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: manifest cannot be larger than 100 MB in phar


搜索后,一堆中文结果,没有一个和报错信息直接有关系,在stackoverflow上看到此类问题,可仍然没能解决我的问题,原因是:

不是直接解答这个问题。

我没能准确理解别人的意思。

别人的回答是:

I do. You are copying all the text and if you see at the bottom are some ASCII characters making the file bad.

Hope i helped you

Edit: you have to Download the file go-pear.phar from http://pear.php.net/go-pear.phar use some download manager then

save as go-pear.phar into WampDir\php\PEAR\go-pear.phar

some ASCII characters making the file bad
use some download manager
这两处关键词已经明确说清楚了问题:乱码,用下载工具下载文件。

我直接打开
https://pear.php.net/go-pear.phar
,然后复制内容到一个PHP文件里。执行CMD命令出错后,按照错误信息查看该文件的1271行,果然是乱码。

右击
https://pear.php.net/go-pear.phar
,选择“将链接另存为”下载了 go-pear。再次执行CMD命令,正常。

用编辑器打开了下载的
go-pear.phar
,1271行仍然是乱码,但不知为何能正常运行。


go-pear安装

Are you installing a system-wide PEAR or a local copy?

这是在询问安装在系统还是本地。

我安装在本地。输入
local
,回车确认。

接下来的是配置询问,我全部使用默认的。

接下来出现提示信息

Would you like to alter php.ini <E:\wamp64\bin\php\php7.0.0\php.ini>? [Y/n] : y

php.ini <E:\wamp64\bin\php\php7.0.0\php.ini> include_path updated.

Current include path           : .;C:\php\pear
Configured directory           : E:\wamp64\bin\php\php7.0.0\pear
Currently used php.ini (guess) : E:\wamp64\bin\php\php7.0.0\php.ini


回车确认后,提示信息

** WARNING! Old version found at E:\wamp64\bin\php\php7.0.0, please remove it or be sure to use the new e:\wamp64\bin\php\php7.0.0\pear.bat command

The 'pear' command is now at your service at e:\wamp64\bin\php\php7.0.0\pear.bat


不明白为何存在旧版 pear,不理会。

将新版 pear
e:\wamp64\bin\php\php7.0.0\pear.bat
加入系统目录。

按照成功。

参考资料

php新手—-WAMP集成环境下安装Pear和PHPUnit –失败了 中的这句话

这里还必须要注意,你下载的Go-pear.phar不要乱码了,最好是直接将链接目标另存为,不要打开网页,复制粘贴,经验之谈

帮了我大忙!我彻底意识到,应该解决乱码问题,而且是下载而不是复制粘贴代码!

回顾我的debug过程,很低效。对检索信息的利用,仅限于直接照着检索结果操作。若检索结果没有直接写明可操作信息,我可能就会错过正确的解决方法。

应该是缺少了思考环节。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php