最初我用的php版本是5.6 ,phpstorm版本是2017.2月版本,配置的xdebug是2.6.1,這三者的版本是兼容的,xdebug斷點調試是可以成功的。
最近將php升級到7.3版本,而xdebug也升級到2.8.0,phpstorm版本就沒有變動,按部就班的將php.ini配置成如下:
[XDebug]
zend_extension="E:\XAMPP\php\ext\php_xdebug.dll"
xdebug.remote_host=localhost
xdebug.remote_port=9002
xdebug.remote_enable=on
xdebug.auto_trace=on
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
phpstorm配置完全與之前的一致,但是就是調不通,一致報如下錯誤:
Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'testXdebug' server at PHP|Servers or enable Break at first line in PHP scripts option
xdebug能進入第一行,第2行之後的代碼一直調試不了,我試着將如下紅線標註的取消掉,一直還是出現上述問題。最後查閱了相關博文之後,可能是由於有php, phpstorm,xdebug三者的版本不兼容造成的。
我隨之將phpstorm版本升級到2019.2版本。xdebug果然成功調通。這個浪費了我一上午的時間,現在將這個坑記錄下來。