phar://go-pear.phar/index.php,php安装pear 错误:Warning: require_once(phar://go-pear.phar/index.php)...

e93754907446cd607c405f338c529d2f.png

先上图:

43d09f63b2a6883c1778ea2015760161.png

重点,重点,重点:重要事情说三遍

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

go-pear.phar乱码错误

wamp64 上按照 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出现错误了:

43d09f63b2a6883c1778ea2015760161.png

各种百度,各种搜狗,最后还是GOOgle靠谱:在GOOGle上搜索到一个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,然后把整个页面直接复制下来,弄了一个txt文本,最后修改文件名字为go-pear.phar。执行CMD后就出现了1271行乱码报错信息。

正确的做法是:打开https://pear.php.NET/go-pear.phar,然后右键另存为,然后它的名字默认会是go-pear.phar.txt,直接把后面的.txt删除,然后保存就OK了!

用编辑器打开文件,找到第1271行还是乱码的,但这次执行就不会报错了!估计原因是win电脑的复制或者保存的时候出的问题。具体原因有待验证!

有一种想直接用Linux开发的冲动!这样就能避免这样的问题了!

go-pear安装

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

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

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

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

接下来出现提示信息

Would you like to alter php.ini ? [Y/n] : y

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 加入系统目录。

按照成功。

参考资料

中的这句话

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

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

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

应该是缺少了思考环节。

[Bill Zhang][1]

Thanks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值