windows下安装pear包管理器
来源:互联网 发布:网络爬虫违法吗 编辑:程序博客网 时间:2024/05/16 01:31
PEAR是PHP扩展与应用库(the PHP Extension and Application Repository)的缩写。它是一个PHP扩展及应用的一个代码仓库,简单地说,PEAR之于PHP就像是CPAN(Comprehensive Perl Archive Network)之于Perl。(摘自pear百度百科)
简单说就是可以供我们使用的代码仓库。有人云程序员都很懒。其实根本意思无非告诉我们有时候不一定每一个技术细节都要我们亲自实现,也要学会站在巨人的肩膀上,可以直接借鉴或使用他人已经实现的成熟代码或者思想,这样也减少出现走弯路的可能,并且经过实践的代码总比重新开发的要安全的多且效率高。
那么如何在windows下安装pear呢?
1.首先,如果你还没有搭建自己的php环境(由于是windows平台,当然php也是for windows的),为了方便,可以使用集成的php环境工具xammp之类的在本机安装。
2.安装好php后,会在php根目录下看到一个go-pear.bat的windows批处理文件。点击执行他,出现提示:
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :
按下回车,继续... 会出现pear目录设置列表:
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) : E:\php5
2. Temporary directory for processing : E:\php5\tmp
3. Temporary directory for downloads : E:\php5\tmp
4. Binaries directory : E:\php5
5. PHP code directory ($php_dir) : E:\php5\pear
6. Documentation directory : E:\php5\docs
7. Data directory : E:\php5\data
8. User-modifiable configuration files directory : E:\php5\cfg
9. Public Web Files directory : E:\php5\www
10. Tests directory : E:\php5\tests
11. Name of configuration file : E:\php5\pear.ini
12. Path to CLI php.exe : E:\php5
1-12, 'all' or Enter to continue: (可以在此输入你要改变的目录路径的项目编号进行设置)
3.确保internet网络正常的情况下,下载必要的包,脚本开始安装中...
Beginning install...
Configuration written to E:\php5\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.7
install ok: channel://pear.php.net/Console_Getopt-1.3.0
install ok: channel://pear.php.net/Structures_Graph-1.0.4
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.4
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"
(此处略去若干字...)
然后为了确保在CMD命令行下找到pear。需要在系统环境变量里注册一个pear的路径。还有一个简单的方法,在安装了pear之后,在php目录下会有个PEAR_ENV.reg文件,点击即可注册环境变量。
4.这个时候,你可以在php的目录下看到了建立的若干pear的相关目录,然后按照官方的要求应该及时更新pear,http://pear.php.net/go-pear.phar 下载一个phar文件,放到php根目录下
然后在CMD命令行进入php的目录,执行:
php go-pear.phar
5.支持pear包管理器已经安装完成,可以在CMD命令行下输入pear,会出现pear命令的帮助文档。为了建议是否已经安装成功,可以在web目录下建立一个php脚本:
<?phprequire_once 'System.php';var_dump(class_exists('System', false));?>
如果成功,应该输入bool(true)。如果未出现并且php报错提示找不到System.php文件,则是因为没有把pear代码库路径加入到php的incude path。我们去php.ini配置文件中的include_path设置pear的路径。
6.利用pear安装一个代码包。例如安装log代码包。CMD命令行下执行
$ pear install log
如果网路没有问题,可以在pear的代码库pear目录下看到一个新建的log目录,那里面就是log代码包的目录了,可以进入看下已经有很多php文件可以供我们使用。
备注:我们可以定制我们的pear包管理器的配置,通过 执行 pear config-set “配置项名” “新的配置值”
- windows下安装pear包管理器
- windows 下pear安装
- Windows下安装PEAR
- php 包管理器PEAR
- Windows下安装python 包管理器pip
- windows下安装python包管理器pip
- [转]windows 下pear安装
- 在Windows下安装pear
- 【转】windows xp下安装pear
- Windows下安装PEAR, PHPUnit成功 (
- 【转载】windows下使用pear安装phpDocumentor
- windows下python的包管理器pip安装.超简单
- 在windows下安装python包管理器pip及使用
- windows下python的包管理器pip安装
- php的pear包管理器下载pear包
- pear安装及pear包HTTP_Request2安装
- 在Windows下安装pear之后安装PHPUnit
- windwos下安装pear
- A股、B股、H股简介
- Y470 Y570双显卡驱动更新及调侃
- Irrlicht引擎源码剖析——第十三天
- 给自己一个方向
- flash's SurfaceTexture
- windows下安装pear包管理器
- 高水位线(High-warter mark, HWM)
- CCD相機專業術語解釋
- Binning
- ajax之jquery与struts2通信
- 集训第二周
- 设计模式——抽象工厂模式
- 濾波和卷積
- cocos2d-x学习笔记(4)--CCLayer背景绘制