在Linux下安装PHP的PEAR,其实不复杂,怎么搜了一下,网上好多介绍,看起来都是一样的文章,其实很简单的。
1)下载
curl -o go-pear.php http://pear.php.net/go-pear
2)运行go-pear.php
debian:~# php go-pear.php
3)这里按回车继续安装,CTRL+C放弃安装。
If you wish to abort, press Control-C now, or press Enter to continue:
4)有没有代理,没有代理直接回车
HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::
安装路径,默认回车

1. Installation prefix ($prefix) : /root
2. Temporary files directory : $prefix/temp
3. Binaries directory : $prefix/bin
4. PHP code directory ($php_dir) : $prefix/PEAR
5. Documentation base directory : $php_dir/docs
6. Data base directory : $php_dir/data
7. Tests base directory : $php_dir/tests

1-7, ‘all’ or Enter to continue:

按Y
Would you like to install these as well? [Y/n] :

然后就直接安装了。

安装的全过程在这里

  1. debian:~# php go-pear.php
  2.  
  3. Welcome to go-pear!
  4.  
  5.  
  6.  
  7. Go-pear will install the 'pear' command and all the files needed by
  8.  
  9. it.  This command is your tool for PEAR installation and maintenance.
  10.  
  11.  
  12.  
  13. Go-pear also lets you download and install the following optional PEAR
  14.  
  15. packages: PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2.
  16.  
  17.  
  18.  
  19.  
  20.  
  21. If you wish to abort, press Control-C now, or press Enter to continue:
  22.  
  23.  
  24.  
  25. HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::
  26.  
  27.  
  28.  
  29. Below is a suggested file layout for your new PEAR installation.  To
  30.  
  31. change individual locations, type the number in front of the
  32.  
  33. directory.  Type 'all' to change all of them or simply press Enter to
  34.  
  35. accept these locations.
  36.  
  37.  
  38.  
  39.  1. Installation prefix ($prefix) : /root
  40.  
  41.  2. Temporary files directory     : $prefix/temp
  42.  
  43.  3. Binaries directory            : $prefix/bin
  44.  
  45.  4. PHP code directory ($php_dir) : $prefix/PEAR
  46.  
  47.  5. Documentation base directory  : $php_dir/docs
  48.  
  49.  6. Data base directory           : $php_dir/data
  50.  
  51.  7. Tests base directory          : $php_dir/tests
  52.  
  53.  
  54.  
  55. 1-7, 'all' or Enter to continue:
  56.  
  57.  
  58.  
  59. The following PEAR packages are bundled with PHP: PEAR_Frontend_Web-beta,
  60.  
  61. PEAR_Frontend_Gtk2, MDB2.
  62.  
  63. Would you like to install these as well? [Y/n] : Y
  64.  
  65.  
  66.  
  67. Loading zlib: ok
  68.  
  69.  
  70.  
  71. Bootstrapping Installer...................
  72.  
  73. Bootstrapping PEAR.php............(remote) ok
  74.  
  75. Bootstrapping Archive/Tar.php............(remote) ok
  76.  
  77. Bootstrapping Console/Getopt.php............(remote) ok
  78.  
  79.  
  80.  
  81. Extracting installer..................
  82.  
  83. Downloading package: PEAR.............ok
  84.  
  85. Downloading package: Structures_Graph....ok
  86.  
  87.  
  88.  
  89. Preparing installer..................
  90.  
  91. Updating channel "pear.php.net"
  92.  
  93. Channel "pear.php.net" is up to date
  94.  
  95. Updating channel "pecl.php.net"
  96.  
  97. Channel "pecl.php.net" is up to date
  98.  
  99.  
  100.  
  101. Installing selected packages..................
  102.  
  103. Downloading and installing package: PEAR.............warning: pear/PEAR requires package "pear/Archive_Tar" (recommended version 1.3.2)
  104.  
  105. warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.2)
  106.  
  107. warning: pear/PEAR requires package "pear/Console_Getopt" (recommended version 1.2.3)
  108.  
  109. pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
  110.  
  111. downloading PEAR-1.7.2.tgz ...
  112.  
  113. Starting to download PEAR-1.7.2.tgz (302,744 bytes)
  114.  
  115. .........................................done: 302,744 bytes
  116.  
  117. install ok: channel://pear.php.net/PEAR-1.7.2
  118.  
  119. PEAR: Optional feature webinstaller available (PEAR's web-based installer)
  120.  
  121. PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
  122.  
  123. PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
  124.  
  125. PEAR: To install optional features use "pear install pear/PEAR#featurename"
  126.  
  127. Installing bootstrap package: Structures_Graph.......install ok: channel://pear.php.net/Structures_Graph-1.0.2
  128.  
  129. Downloading and installing package: Archive_Tar-stable.......downloading Archive_Tar-1.3.2.tgz ...
  130.  
  131. Starting to download Archive_Tar-1.3.2.tgz (17,150 bytes)
  132.  
  133. ...done: 17,150 bytes
  134.  
  135. install ok: channel://pear.php.net/Archive_Tar-1.3.2
  136.  
  137. Downloading and installing package: Console_Getopt-stable.......downloading Console_Getopt-1.2.3.tgz ...
  138.  
  139. Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes)
  140.  
  141. ...done: 4,011 bytes
  142.  
  143. install ok: channel://pear.php.net/Console_Getopt-1.2.3
  144.  
  145. Downloading and installing package: PEAR_Frontend_Web-beta.......downloading PEAR_Frontend_Web-0.7.3.tgz ...
  146.  
  147. Starting to download PEAR_Frontend_Web-0.7.3.tgz (53,152 bytes)
  148.  
  149. ...done: 53,152 bytes
  150.  
  151. downloading HTML_Template_IT-1.2.1.tgz ...
  152.  
  153. Starting to download HTML_Template_IT-1.2.1.tgz (21,565 bytes)
  154.  
  155. ...done: 21,565 bytes
  156.  
  157. install ok: channel://pear.php.net/HTML_Template_IT-1.2.1
  158.  
  159. install ok: channel://pear.php.net/PEAR_Frontend_Web-0.7.3
  160.  
  161. Downloading and installing package: PEAR_Frontend_Gtk2.......Did not download optional dependencies: pear/XML_Parser, pear/XML_Util, use --alldeps to download automatically
  162.  
  163. Did not download optional dependencies: pear/System_Command, use --alldeps to download automatically
  164.  
  165. pear/PEAR_Frontend_Gtk2 requires PHP extension "php-gtk" (version >= 2.0.0dev)
  166.  
  167. pear/Config can optionally use package "pear/XML_Parser"
  168.  
  169. pear/Config can optionally use package "pear/XML_Util"
  170.  
  171. pear/Gtk2_EntryDialog requires PHP extension "php-gtk" (version >= 2.0.0dev)
  172.  
  173. pear/Gtk2_FileDrop requires PHP extension "php-gtk" (version >= 2.0.0dev)
  174.  
  175. pear/MIME_Type can optionally use package "pear/System_Command"
  176.  
  177. downloading Config-1.10.11.tgz ...
  178.  
  179. Starting to download Config-1.10.11.tgz (0 bytes)
  180.  
  181. ...done: 0 bytes
  182.  
  183. could not extract the package.xml file from "/root/temp/download/Config-1.10.11.tgz"
  184.  
  185. Download of "pear/Config" succeeded, but it is not a valid package archive
  186.  
  187. Error: cannot download "pear/Config"
  188.  
  189. downloading MIME_Type-1.1.3.tgz ...
  190.  
  191. Starting to download MIME_Type-1.1.3.tgz (8,805 bytes)
  192.  
  193. ...done: 8,805 bytes
  194.  
  195. install ok: channel://pear.php.net/MIME_Type-1.1.3
  196.  
  197. Downloading and installing package: MDB2.............downloading MDB2-2.4.1.tgz ...
  198.  
  199. Starting to download MDB2-2.4.1.tgz (119,790 bytes)
  200.  
  201. ...done: 119,790 bytes
  202.  
  203. install ok: channel://pear.php.net/MDB2-2.4.1
  204.  
  205. MDB2: Optional feature fbsql available (Frontbase SQL driver for MDB2)
  206.  
  207. MDB2: Optional feature ibase available (Interbase/Firebird driver for MDB2)
  208.  
  209. MDB2: Optional feature mysql available (MySQL driver for MDB2)
  210.  
  211. MDB2: Optional feature mysqli available (MySQLi driver for MDB2)
  212.  
  213. MDB2: Optional feature mssql available (MS SQL Server driver for MDB2)
  214.  
  215. MDB2: Optional feature oci8 available (Oracle driver for MDB2)
  216.  
  217. MDB2: Optional feature pgsql available (PostgreSQL driver for MDB2)
  218.  
  219. MDB2: Optional feature querysim available (Querysim driver for MDB2)
  220.  
  221. MDB2: Optional feature sqlite available (SQLite2 driver for MDB2)
  222.  
  223. MDB2: To install optional features use "pear install pear/MDB2#featurename"
  224.  
  225.  
  226.  
  227. ******************************************************************************
  228.  
  229. WARNING!  The include_path defined in the currently used php.ini does not
  230.  
  231. contain the PEAR PHP directory you just specified:
  232.  
  233. </root/PEAR>
  234.  
  235. If the specified directory is also not in the include_path used by
  236.  
  237. your scripts, you will have problems getting any PEAR packages working.
  238.  
  239.  
  240.  
  241.  
  242.  
  243. Would you like to alter php.ini </etc/php5/cli/php.ini>? [Y/n] : y
  244.  
  245.  
  246.  
  247. php.ini </etc/php5/cli/php.ini> include_path updated.
  248.  
  249.  
  250.  
  251. Current include path           : .:/usr/share/php:/usr/share/pear
  252.  
  253. Configured directory           : /root/PEAR
  254.  
  255. Currently used php.ini (guess) : /etc/php5/cli/php.ini
  256.  
  257. Press Enter to continue:
  258.  
  259.  
  260.  
  261. The 'pear' command is now at your service at /root/bin/pear
  262.  
  263.  
  264.  
  265. ** The 'pear' command is not currently in your PATH, so you need to
  266.  
  267. ** use '/root/bin/pear' until you have added
  268.  
  269. ** '/root/bin' to your PATH environment variable.
  270.  
  271.  
  272.  
  273. Run it without parameters to see the available actions, try 'pear list'
  274.  
  275. to see what packages are installed, or 'pear help' for help.
  276.  
  277.  
  278.  
  279. For more information about PEAR, see:
  280.  
  281.  
  282.  
  283.   http://pear.php.net/faq.php
  284.  
  285.   http://pear.php.net/manual/
  286.  
  287.  
  288.  
  289. Thanks for using go-pear!