第一步:查看PHP版本信息
第二步:到xdebug下載頁去下載最新的版本(注意:要下載PHP對應版本)https://xdebug.org/download.php
第三步:把擴展php_xdebug-2.7.0alpha1-7.2-vc15-nts.dll放到php的擴展目錄(ext文件中)
我的路徑爲:D:\phpStudy\PHPTutorial\php\php-7.2.1-nts
第四步:打開php.ini文件,配置如下:
[XDebug]
zend_extension=php_xdebug-2.7.0alpha1-7.2-vc15-nts.dll
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir ="D:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir ="D:\phpStudy\tmp\xdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.remote_mode = "req"
xdebug.idekey = PHPSTORM
說明:改項也可以寫絕對路徑
zend_extension=D:\phpStudy\PHPTutorial\php\php-7.2.1-nts\ext\php_xdebug-2.7.0alpha1-7.2-vc15-nts.dll
或者在cmd窗口輸入php -m命令查看擴展,注意如果報命令無效時,要添加php.exe到環境變量中