windows系統中安裝 pear

來源:互聯網
上載者:User

今天簡單記錄一下我在windows下安裝pear的過程,

我的安裝環境為win7、wampserver2.4、php5.4.16。

安裝步驟

1. 下載 http://pear.php.net/go-pear.phar,我是把下載下來的go-pear.phar檔案放到 E:/wamp/bin/pear/ ,因為我打算把pear安裝到  E:/wamp/bin/pear/

2. 命令列下運行php go-pear.phar


E:/wamp/bin/pear>php go-pear.phar
 
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :
3. 輸入system,然後斷行符號,出現如下介面:

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:/wamp/bin/pear
 2. Temporary directory for processing            : E:/wamp/bin/pear/tmp
 3. Temporary directory for downloads             : E:/wamp/bin/pear/tmp
 4. Binaries directory                            : E:/wamp/bin/pear
 5. PHP code directory ($php_dir)                 : E:/wamp/bin/pear/pear
 6. Documentation directory                       : E:/wamp/bin/pear/docs
 7. Data directory                                : E:/wamp/bin/pear/data
 8. User-modifiable configuration files directory : E:/wamp/bin/pear/cfg
 9. Public Web Files directory                    : E:/wamp/bin/pear/www
10. Tests directory                               : E:/wamp/bin/pear/tests
11. Name of configuration file                    : C:/Windows/pear.ini
12. Path to CLI php.exe                           : E:/wamp/bin/php/php5.4.16
 
1-12, 'all' or Enter to continue:
4.預設安裝目錄結構是如上,如果想改變目錄就輸入前面色數字,我在這裡輸入的是11,因為我想將pear.ini檔案和php.ini檔案放在同一個目錄中,輸入11後讓你填入pear.ini路徑,我在這裡填入的是  E:/wamp/bin/php/php5.4.16/pea r.ini


1-12, 'all' or Enter to continue: 11
(Use $prefix as a shortcut for 'E:/wamp/bin/pear', etc.)
Name of configuration file [C:/Windows/pear.ini] : E:/wamp/bin/php/php5.4.16/pear.ini
5. 接下來會出現類似步驟3的介面,此時直接斷行符號就可以了。

6. 接下來是提示是否把修改php.ini,插入包含路徑,輸入Y,否則要手動修改。

7. 此時介面會提示 Press Enter to continue: ,直接斷行符號就可以了。

8. 將pear添加到環境變數中,如下圖


9.註冊環境變數,執行PEAR_ENV.reg。
10. 測試,在dos中輸入 pear help  若能輸出很多協助選項那就是成功安裝。再嘗試用一些pear功能,如果沒問題,恭喜你,pear安裝成功了。如果不正常,執行  pear config-show  查看是否配置正確了,如果確保配置正常的話,重啟電腦試試。
pear的目錄結構
 
  • cfg: 使用者驗證設定檔夾
  • data: 資料儲存檔案夾
  • pear: 主要的PHP檔案夾
  • tests: 測試檔案夾
  • tmp: 臨時檔案夾
  • www: 網路檔案夾
其中預設cfg www 檔案夾是空的,data docs pear 三個檔案裡面在每一次用pear命令安裝一個軟體都會在裡面建立一個檔案夾儲存軟體的資料,比如筆者安裝phpdocumentor ,那麼在這三個檔案夾裡面都會有phpdocumentor檔案夾。
卸載或重裝
  1. 如果是自訂安裝目錄的話卸載很簡單,把pear安裝的目錄全部刪除,把php安裝目錄下的pear.ini檔案也刪除;
  2. 否則就要到php安裝目錄下把找到上面圖片的目錄和檔案一個一個刪除。這就是為什麼筆者強調自訂安裝的原因;
  3. 然後重新安裝。


如果你想在linux下安裝pear,可以訪問我之前寫的  linux下安裝pear。

現在開始安裝

$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

安裝過程會提示配置一些參數,我都是用的預設值


 1. Installation base ($prefix)                   : /usr/local/php
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/local/php/bin
 5. PHP code directory ($php_dir)                 : /usr/local/php/share/pear
 6. Documentation directory                       : /usr/local/php/docs
 7. Data directory                                : /usr/local/php/data
 8. User-modifiable configuration files directory : /usr/local/php/cfg
 9. Public Web Files directory                    : /usr/local/php/www
10. Tests directory                               : /usr/local/php/tests
11. Name of configuration file                    : /usr/local/php/etc/pear.conf

安裝完畢之後,來檢測一下


# /usr/local/php/bin/pear
Commands:
build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
channel-alias          Specify an alias to a channel name
channel-delete         Remove a Channel From the List
......

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.