看到PEAR章节,提到安装PEAR需要go-pear.bat,我机器上的PHP(v7.0.8)目录下,并没有go-pear.bat这个文件,网上查了一遍,怎么说的都有,最后还是在官网上找到解决方案。

http://pear.php.net/manual/en/installation.getting.php

Windows

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

in a Windows Command Prompt to start the installation.

The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.

Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that's now found in the PHP source directory.

After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.

After changing php.ini, you will need to restart your web server.

Now check that PEAR works.

为什么目录下有可能不存在go-pear.bat?这是个问题。

大概是以下几个原因:

1.历史原因,曾经发布的包里是包含go-pear.bat的,现在新版本的已经取消【如此重要的扩展库,是不是天然包含更好一些?】

有待研究,慢慢补充

=====================================================================================

Microsoft Windows [版本 10.0.10586]
(c) 2015 Microsoft Corporation。保留所有权利。
 
D:\PHPx64>php go-pear.php
Sorry! Your PHP version is too new (7.0.8) for this go-pear.
Instead use http://pear.php.net/go-pear.phar for a more stable and current
version of go-pear, more suited to your PHP version.
 
Thank you for your coopertion and sorry for the inconvenience!【这里有个错误单词,谁知道如何提交给PHP官方?】
 
D:\PHPx64>php go-pear.phar
 
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : local
Please confirm local copy by typing 'yes' : yes
 
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
 
1. Installation base ($prefix) : D:\PHPx64
2. Temporary directory for processing : D:\PHPx64\tmp
3. Temporary directory for downloads : D:\PHPx64\tmp
4. Binaries directory : D:\PHPx64
5. PHP code directory ($php_dir) : D:\PHPx64\pear
6. Documentation directory : D:\PHPx64\docs
7. Data directory : D:\PHPx64\data
8. User-modifiable configuration files directory : D:\PHPx64\cfg
9. Public Web Files directory : D:\PHPx64\www
10. System manual pages directory : D:\PHPx64\man
11. Tests directory : D:\PHPx64\tests
12. Name of configuration file : D:\PHPx64\pear.ini
13. Path to CLI php.exe : D:\PHPx64
 
1-13, 'all' or Enter to continue:
Beginning install...
Configuration written to D:\PHPx64\pear.ini...
Initialized registry...
Preparing to install...
installing phar://D:/PHPx64/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.0.tar...
installing phar://D:/PHPx64/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar...
installing phar://D:/PHPx64/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.1.tar...
installing phar://D:/PHPx64/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar://D:/PHPx64/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.3.0.tar...
install ok: channel://pear.php.net/Archive_Tar-1.4.0
install ok: channel://pear.php.net/Console_Getopt-1.4.1
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.3.0
install ok: channel://pear.php.net/PEAR-1.10.1
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
 
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<D:\PHPx64\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
 
 
Would you like to alter php.ini <D:\PHPx64\php.ini>? [Y/n] : y
 
php.ini <D:\PHPx64\php.ini> include_path updated.
 
Current include path : .;C:\php\pear
Configured directory : D:\PHPx64\pear
Currently used php.ini (guess) : D:\PHPx64\php.ini
Press Enter to continue:
 
** WARNING! Old version found at D:\PHPx64, please remove it or be sure to use the new d:\phpx64\pear.bat command
 
The 'pear' command is now at your service at d:\phpx64\pear.bat
 
** The 'pear' command is not currently in your PATH, so you need to
** use 'd:\phpx64\pear.bat' until you have added
** 'D:\PHPx64' to your PATH environment variable.
 
Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.
 
For more information about PEAR, see:
 
http://pear.php.net/faq.php
http://pear.php.net/manual/
 
Thanks for using go-pear!
 ==================================================================================
按书上操作,假设希望安装Auth包,此命令和相应的输出如下:
 
D:\PHPx64>pear install auth
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
WARNING: "pear/MDB" is deprecated in favor of "pear/MDB2"
WARNING: "pear/HTTP_Client" is deprecated in favor of "pear/HTTP_Request2"
Package "vpopmail" does not have REST info xml available
Package "kadm5" does not have REST info xml available
Did not download optional dependencies: pear/Log, pear/File_Passwd, pear/Net_POP3, pear/DB, pear/MDB, pear/MDB2, pear/Auth_RADIUS, pear/Crypt_CHAP, pear/File_SMBPasswd, pear/HTTP_Client, pear/SOAP, pear/Net_Vpopmaild, pecl/vpopmail, pecl/kadm5, use --alldeps to download automatically
pear/Auth can optionally use package "pear/Log" (version >= 1.9.10)
pear/Auth can optionally use package "pear/File_Passwd" (version >= 1.1.0)
pear/Auth can optionally use package "pear/Net_POP3" (version >= 1.3.0)
pear/Auth can optionally use package "pear/DB" (version >= 1.6.0)
pear/Auth can optionally use package "pear/MDB"
pear/Auth can optionally use package "pear/MDB2" (version >= 2.0.0RC1)
pear/Auth can optionally use package "pear/Auth_RADIUS"
pear/Auth can optionally use package "pear/Crypt_CHAP" (version >= 1.0.0)
pear/Auth can optionally use package "pear/File_SMBPasswd" (version >= 1.0.0)
pear/Auth can optionally use package "pear/HTTP_Client" (version >= 1.1.0)
pear/Auth can optionally use package "pear/SOAP" (version >= 0.9.0)
pear/Auth can optionally use package "pear/Net_Vpopmaild" (version >= 0.1.0)
pear/Auth can optionally use package "pecl/vpopmail" (version >= 0.2)
pear/Auth can optionally use package "pecl/kadm5" (version >= 0.2.3)
pear/Auth can optionally use PHP extension "imap"
pear/Auth can optionally use PHP extension "saprfc"
pear/Auth can optionally use PHP extension "soap"
downloading Auth-1.6.4.tgz ...
Starting to download Auth-1.6.4.tgz (56,771 bytes)
..............done: 56,771 bytes
ERROR: failed to mkdir C:\php\pear\data\Auth\Auth\Frontend
 
最后告诉我failed to mkdir C:\php\pear\data\Auth\Auth\Frontend,然而,我的PHP装在了D盘,这该如何是好?!?有没有提供一种指定路径的方式?或者,在哪里能改?
既然说failed to mkdir,有可能是因为权限,我是从“运行”中启动的cmd,找到快捷方式后,以管理员权限运行,这次报install ok:channel://pear.php.net/Auth-1.6.4,看来是安装成功。然后,按照刚才报错的理解,应该是装到C:\php\pear\里了,经查,确实在。那么,把C盘的pear目录复制到我的D盘PHP的pear目录。
这种方式,非常不智能。
 
http://pear.php.net/packages.php
这里是可安装的包
 
安装go-pear之后,会在php.ini中增加一行:
;***** Added by go-pear
include_path=".;D:\PHPx64\pear"
;*****
所以,使用require_once时,直接使用require_once("Numbers/Roman.php");即可。
 

PEAR安装的更多相关文章

  1. PHP pear安装

    PHP pear安装 Posted on 2012-07-06 10:19 bug yang 阅读(5787) 评论(0) 编辑 收藏 转自:http://wangye.org/blog/archiv ...

  2. [php-pear]如何使用 PHP-PEAR安装器,以及使用 PEAR 安装扩展库

    我们都知道 PHP PEAR,就是 PHP Extension and Application Respository,也就是 PHP 扩展和应用代码库. PHP 也可以通过 PEAR 安装器来进行 ...

  3. 【转】PEAR安装、管理及使用

    PEAR安装   linux下只要你安装的是PHP 4.3.0以上的版本,默认安装都是支持PEAR的,除非你使用了”--WITHOUT-PEAR”选项,修改PHP.INI文件,在INCLUDE_PAT ...

  4. PHP pear安装出现 Warning: require_once(Structures/Graph.php)...错误

    今天在WINDOWS安装pear,一路无阻很顺利安装完成,接着想安装下pear email包来玩下,但接下来却报: Warning: require_once(Structures/Graph.php ...

  5. xampp 通过pear安装PHP_UML

    1.在环境变量中添加D:\xampp\php   // 如果前面已经有其他环境变量了,那么要用分号;跟前面的隔开 2.ctrl+R , cmd , pear install PHP_UML 3.如果提 ...

  6. windos下安装PEAR 注意

    1.在这里下载PEAR http://pear.php.net/go-pear.phar 在页面右键另存为 go-pear.phar 到PHP的根目录,并去目录查看是否保存为了go-pear.phar ...

  7. [转]pear windows 安装

    FROM : http://jingyan.baidu.com/article/ca41422fd8cf3d1eae99ed3e.html 因为想使用phpdocument生成文档,不得不安装pear ...

  8. 在WINDOWS下安装PEAR

    一.从官网下载go-pear.phar 文件,地址http://pear.php.net/go-pear.phar 将下载好的文件go-pear.phar 放到PHP安装目录下,dos 命令下进入PH ...

  9. 安装最新版本的PHPUnit后,不能使用

    我使用的是widows系统.本来3.7.8版本的Phpunit用的是非常顺畅的,最近重新安装phpunit,安装了最小版本,然后在使用的时候就会报很多各种错误.无奈之下只能降版本到3.7.8 首先要卸 ...

随机推荐

  1. xamarin.forms uwp app部署到手机移动设备进行测试,真机调试(device portal方式部署)

    最近学习xamarin.刚好 手上有一个lumia 930.所以试一试把uwp app部署到手机上,并真机调试一把. 目前环境: 1.开发pc电脑是win10,版本1607.加入了insider,所以 ...

  2. 如何解决ajax重复提交的问题

    如下一段代码: 先忽略我没引jquery.js的问题,这是一个案例. 当我们点击提交时,控制台输出两次e,在network里查看,可以看到我们的ajax传输了两次,造成了数据重复提交. 一种解释为bu ...

  3. NBUT 1457 莫队算法 离散化

    Sona Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Submit Status Practice NBUT 145 ...

  4. neo4j-简介,安装

    1. Neo4j简介 Neo4j是一个用Java实现的.高性能的.NoSQL图形数据库. Neo4j 使用图(graph)相关的概念来描述数据模型,通过图中的节点和节点的关系来建模. Neo4j完全兼 ...

  5. JS:window.onload的使用

    1.最简单的调用方式 直接写到html的body标签里面,如: (html) (body onload="func()") (/body) (/html) 2.在JS语句调用 (s ...

  6. 【poj2409】 Let it Bead

    http://poj.org/problem?id=2409 (题目链接) 题意 一个n个珠子的项链,每个珠子可以被染成t种颜色.项链可以翻转和旋转,问不同的染色方案数. Solution Pólya ...

  7. ReactNative 根据scrollView/listview滑动距离动态修改NavBar颜色

    我们常见某些APP上滑的时候,NavBar颜色会从透明渐变为某种颜色 原理非常简单,根据scrollView的回调动态修改NavBar的透明度即可. 在RN中,尤其是ListView中这个回调不是很好 ...

  8. 【原创】PageAdminCMS 前台SQL注入漏洞(2)

    之前根据公司的要求找了几个web程序的漏洞提交CNVVD,发现漏洞提交上去两个月了,CNVVD却没有任何回应,我提交的这几个漏洞却悄悄的修补掉了. 文章作者:rebeyond 受影响版本:V3.0 漏 ...

  9. eclipse 快捷键大全(转载)

    Ctrl+1 快速修复(最经典的快捷键,就不用多说了)Ctrl+D: 删除当前行 Ctrl+Alt+↓ 复制当前行到下一行(复制增加)Ctrl+Alt+↑ 复制当前行到上一行(复制增加)Alt+↓ 当 ...

  10. leetcode笔记

    82. Remove Duplicates from Sorted List II https://leetcode.com/problems/remove-duplicates-from-sorte ...