roger2001c 发表于 2017-3-25 09:54:23

xampp + eclipse 环境下如何调试PHP

  最近开发要一个PHP项目,所以打算安装PHP的调试环境,结果弄了一天,总算搞定了,有点心得跟大家分享一下。

安装xampp
  现在最新的版本是1.7.3,去下载下来,安装即可,这步很简单。
  下载页面
http://www.fogtowerblog.com/wp-content/uploads/debug-php/xampp.jpg

下载eclipse
  去网上下载一个 PDT 2.1 SR-1 All In Ones 版本的eclipse,下载地址在下面:
下载页面
http://www.fogtowerblog.com/wp-content/uploads/debug-php/eclipse.jpg

下载Xdebug
  我用Xdebug来调试PHP,可以在这里下载Xdebug
下载页面
http://www.fogtowerblog.com/wp-content/uploads/debug-php/xdebug.jpg
  把下载下来后的Xdebug,放到C:\xampp\php\ext\目录下,当然也可以选其他目录

配置PHP.ini
  在PHP.ini最下方,加入下列代码:

[XDebug]
;; Only Zend OR (!) XDebug
zend_extension_ts="C:\xampp\php\ext\php_xdebug-2.0.5-5.3-vc6.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"



  千万别忘了,在PHP.ini中找到zend_extension, 把它修改为:

zend_extension = "C:\xampp\php\ext\php_xdebug-2.0.5-5.3-vc6.dll"



  我就是没有修改这个,一直调试不成功,浪费了很多时间。

配置eclipse
  找到Windows -> Preferences -> PHP ->PHP Executables 加入xdebug
http://www.fogtowerblog.com/wp-content/uploads/debug-php/eclipse-config1.jpg
  然后在debug configuration 里面配置就好了。
http://www.fogtowerblog.com/wp-content/uploads/debug-php/eclipse-config2.jpg
  下面就可以调试PHP了。
http://www.fogtowerblog.com/wp-content/uploads/debug-php/eclipse-config3.jpg
  可以参考我的博客
页: [1]
查看完整版本: xampp + eclipse 环境下如何调试PHP