liunx pear安装
pear是什么。它是一个PHP扩展及应用的一个代码仓库,简单地说,pear就是PHP的cpan。
在官网上有说明详细的安装信息,这里作简单说明。
http://pear.php.net/manual/en/about-pear.php #都是英文的 对于英文不好的小伙伴就。。。。。比如我^-^
我的PHP目录为/usr/local/php5
在Linux下安装PHP的PEAR:
1)下载
#curl -o go-pear.php http://pear.php.net/go-pear
如果提示:
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) ‘json.so’ in Unknown on line 0
Sorry! Your PHP version is too new (5.2.9) 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.
那么要从http://pear.php.net/go-pear.phar获取。
#curl -o go-pear.php http://pear.php.net/go-pear.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3594k 100 3594k 0 0 186k 0 0:00:19 0:00:19 –:–:– 196k
会在当前目录下载go-pear.php 页面。
2)运行go-pear.php
#php go-pear.php
3)这里按回车继续安装,CTRL+C放弃安装。
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) : /root/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /root/pear/bin
5. PHP code directory ($php_dir) : /root/pear/share/pear
6. Documentation directory : /root/pear/docs
7. Data directory : /root/pear/data
8. User-modifiable configuration files directory : /root/pear/cfg
9. Public Web Files directory : /root/pear/www
10. System manual pages directory : /root/pear/man
11. Tests directory : /root/pear/tests
12. Name of configuration file : /root/.pearrc
1-12, 'all' or Enter to continue: 1
(Use $prefix as a shortcut for '/root/pear', etc.)
Installation base ($prefix) [/root/pear] : /usr/local/php5/pear
4) 这边是安装路径默认是当前文件夹我要安装到php文件夹下我设置了下
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) : /usr/local/php/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /usr/local/php/pear/bin
5. PHP code directory ($php_dir) : /usr/local/php/pear/share/pear
6. Documentation directory : /usr/local/php/pear/docs
7. Data directory : /usr/local/php/pear/data
8. User-modifiable configuration files directory : /usr/local/php/pear/cfg
9. Public Web Files directory : /usr/local/php/pear/www
10. System manual pages directory : /usr/local/php/pear/man
11. Tests directory : /usr/local/php/pear/tests
12. Name of configuration file : /root/.pearrc
1-12, 'all' or Enter to continue:
Beginning install…
Configuration written to /usr/local/php5/etc/pear.conf…
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”
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
</usr/local/php5/pear/share/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 </usr/local/php5/etc/php.ini>? [Y/n] : y
5)这边是询问是否在php.ihi添加扩展
php.ini </usr/local/php5/etc/php.ini> include_path updated.
Current include path : .:/usr/local/php5/lib/php
Configured directory : /usr/local/php5/pear/share/pear
Currently used php.ini (guess) : /usr/local/php5/etc/php.ini
Press Enter to continue:
** WARNING! Backed up old pear to /usr/local/php5/bin/pear_old
The 'pear' command is now at your service at /usr/local/php5/pear/bin/pear
** The 'pear' command is not currently in your PATH, so you need to
** use '/usr/local/php5/pear/bin/pear' until you have added
** '/usr/local/php5/pear/bin' 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!
6)安装完成添加环境变量
通过pear 就可以使用pear 底下的各种命令了