1、Install XDebug,I highly recommend you make a simple test.php file, put a phpinfo(); statement in there, then copy the output and paste it into the XDebug installation wizard. It will analyze it and give you tailored installation instructions for your environment. In short:
On Windows: Download the appropiate precompiled DLL for your PHP version, architecture (64/32 Bit), thread safety (TS/NTS) and Visual Studio compiler version and place it in your PHP extension folder.如:PHP 7.2 VC15 TS (32 bit)
On Linux: Either download the source code as a tarball or clone it with git, then compile it.
2、Configure PHP to use XDebug by adding zend_extension=path/to/xdebug to your php.ini. The path of your php.ini is shown in your phpinfo() output under "Loaded Configuration File".
3、Enable remote debugging in your php.ini:
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
实际上,直接将该php_xdebug-2.6.1-7.2-vc15.dll放在php根下的zend_ext目录下,然后php.ini中添加以下内容即可:
zend_extension = C:\Program Files\php\zend_ext\php_xdebug-2.6.1-7.2-vc15.dll
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
验证方法:cmd执行命令php -m看是否包含以下的输出内容
[Zend Modules]
Xdebug