windows下安裝pear及phpunit(注意配置好php命令列環境)

來源:互聯網
上載者:User

安裝環境
  在安裝PEAR之前需要配置安裝PHP環境,如果沒有內建PEAR

(直接存取http://go-pear.org並儲存其首頁為go-pear.php)

PEAR安裝準備

  如果PHP運行環境沒有內建PEAR,則需要下載go-pear.php檔案,同時儲存在php.exe所在的目錄下。

PEAR安裝步驟

1、我這裡用的是wampIntegration Environment,d:\wamp\bin\php\php5.2.5>go-pear,開始自動安裝。

通過這個PEAR安裝,可以看到首先需要確認PEAR的安裝目錄結構,系統通常能自動識別。

2、確認好PEAR在Windows下的安裝目錄結構,斷行符號,開始下載和安裝PEAR的預設擴充包,你也可以選擇是否同時安裝Pear_Frontend_Web-beta,Pear_Frontend_Gtk2,MDB2擴充包。

3、PEAR預設擴充包安裝後,提示是否需要配置php.ini檔案中的include_path選項指向pear的安裝目錄,當然需要配置,否則無法使用,Y並斷行符號,安裝包會自動修改include_path選項。

PEAR安裝完成,雙擊PEAR_ENV.reg將相關資訊匯入註冊表,同時重啟Apache即可。

PEAR的其他安裝方法

  如果PHP運行環境內建PEAR,則可以在PHP目錄下找到PEAR.DAT檔案,雙擊這個檔案即可進行PEAR安裝,方式應該類似上述安裝方式。同時注意修改PHP.INI中的include_path選項即可。

PEAR命令

  在命令列方式下,運用PEAR的相關命令可以安裝自己需要的PEAR安裝包。

  pear help 列出pear的所有命令,類似於pear的命令協助命令。

  pear help <command> 列出某個pear命令的具體資訊

  pear help shortcuts 列出所有pear命令的簡寫

  pear list-all 列出所有可安裝的packages,很多,可以訪問pear擴充包列表找到需要的packages,再使用pear install命令安裝package。

(安裝pear時,可以讓其使用預設值,一直斷行符號完。)

 

接著安裝單元測試架構phpunit:

d:\wamp\bin\php\php5.2.5>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded

d:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channel:/
/pear.symfony-project.com/YAML, use --alldeps to download automatically
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version is
1.6.1
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.2
.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "channel://pear.symfony-project.com/Y
AML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed
(安裝phpunit失敗,此時通過pear upgrade pear更新pear後繼續安裝)

d:\wamp\bin\php\php5.2.5>pear upgrade pear
downloading PEAR-1.9.0.tgz ...
Starting to download PEAR-1.9.0.tgz (291,634 bytes)
......

d:\wamp\bin\php\php5.2.5>pear info pear
ABOUT PEAR.PHP.NET/PEAR-1.9.0
......

d:\wamp\bin\php\php5.2.5>pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized

d:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit
Unknown remote channel: pear.symfony-project.com
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channel:/
/pear.symfony-project.com/YAML, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.2
.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "channel://pear.symfony-project.com/Y
AML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.4.13.tgz ...
Starting to download PHPUnit-3.4.13.tgz (254,903 bytes)
.....................................................done: 254,903 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.4.13

phpunit安裝完畢,可輸入phpunit測試

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.