Eclipse/PDT xdebug調試PHP

來源:互聯網
上載者:User

軟體:

XAMPP 1.6.6 解壓縮版。

PDT 1.0.2 Release All-in-One。

XDebug 2.0.2 | Windows modules PHP 5.2.1-5.2.7。

注意xdebug的版本必須和XAMPP中的PHP版本相容,XAMPP 1.6.6中PHP版本是5.2.5,所以使用XDebug 2.0.2 | Windows modules PHP 5.2.1-5.2.7

安裝:

安裝XAMPP

解壓縮XAMPP,運行根目錄下的setup_xampp.bat進行安裝

運行xampp_start.exe啟動伺服器,在瀏覽器中輸入 http://localhost 進行測試

運行xampp_stop.exe關閉伺服器

安裝XDebug

將下載的php_xdebug-2.0.2-5.2.5.dll改名為php_xdebug.dll,複製到xampp\php\ext\目錄下

修改xampp\apache\bin\php.ini檔案,尋找[Zend]程式碼片段,將此程式碼片段下全部用“;”注釋掉,尋找[XDebug]程式碼片段,將zend_extension_ts,xdebug.remote_enable,xdebug.remote_host,xdebug.remote_port,xdebug.remote_handler前面的“;”注釋符去掉

運行xampp_start.exe啟動伺服器,在瀏覽器中輸入 http://localhost/xampp/phpinfo.php,尋找字串Xdebug,如果能尋找到,說明安裝成功。

為什麼要注釋掉[Zend]程式碼片段?因為Zend Optimizer和Xdebug 2.0.2不相容,會導致XAMPP啟動失敗。

安裝PDT

解壓縮pdt-all-in-one-R20080103-win32.zip,運行eclipse.exe啟動PDT(注意:因為eclipse是java寫的,所以需要先安裝JRE)

配置XDebug在PDT中使用,建立一debug.php檔案,內容如下:

<?php
function add($a, $b) {
$result = $a + $b;
return $result;
}
echo add(4, 5);
?>

聯繫我們

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