PHPStorm+XDebug进行调试

一、XDebug安装配置

(1)下载XDebug下载地址:http://www.xdebug.org/必须下载跟机器上安装的php匹配的版本才行。具体下载方法如下:将phpinfo网页的源代码拷贝到http://www.xdebug.org/find-binary.php,然后按照指导安装即可。如下图所示:

PHPStorm+XDebug进行调试

2)安装XDebug按照上图下载“php_xdebug-2.3.2-5.4-vc9.dll”,将其复制到d:\php\ext\目录。

(3)配置XDebug打开d:\php\php.ini,在末尾增加如下代码:

[Xdebug]
zend_extension = d:\php\ext\php_xdebug-2.3.2-5.4-vc9.dll
xdebug.remote_enable =1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000

重启Apache。

(4)验证安装是否成功检测方法1:在phpinfo网页中,能够检索到XDebug字样,就安装成功了,如下图所示:

PHPStorm+XDebug进行调试

 

二、PHPStorm中XDebug配置在【File】->【Settings】->【Languages & Frameworks】->【PHP】的Setting中:

(1)配置PHP Server找到【Servers】,配置项如下: Name:localhostHost:localhostPort:80Debugger:XDebug如下图所示:

PHPStorm+XDebug进行调试

 

 (2)配置PHP Debug找到【Debug】,XDebug中的Debug Port填写9000,其它默认。如下图所示:

 

PHPStorm+XDebug进行调试

 

 调试步骤:

 

PHPStorm+XDebug进行调试