| 組件 | 版本 | 備註 |
|---|---|---|
| XAMPP | 1.6.6 | 解壓版,含 PHP 5.2.5 |
| PDT | 1.0.2 All-in-One | 含 Eclipse 基礎包 |
| XDebug | 2.0.2 | Windows modules PHP 5.2.1-5.2.7 |
關鍵:Xdebug 版本必須與 XAMPP 內置 PHP 版本兼容。
setup_xampp.batxampp_start.exe 啟動服務https://localhost 驗證xampp_stop.exe 關閉php_xdebug-2.0.2-5.2.5.dll 重命名為 php_xdebug.dll,複製至 xampp/php/ext/xampp/apache/bin/php.ini:
[Zend] 區段所有行(Zend Optimizer 與 Xdebug 2.0.2 不兼容,導致啟動失敗)[XDebug] 區段:去掉 zend_extension_ts、xdebug.remote_enable、xdebug.remote_host、xdebug.remote_port、xdebug.remote_handler 前的分號https://localhost/xampp/phpinfo.php 搜索 "Xdebug" 驗證pdt-all-in-one-R20080103-win32.zipeclipse.exe(需預裝 JRE)創建測試文件 debug.php:
<?php
function add($a, $b) {
$result = $a + $b;
return $result;
}
echo add(4, 5);
?>
在 PDT 中配置 Debug Configurations → PHP Web Page,設置 XDebug 作為調試器,即可斷點調試。