在Debian下让PhpStorm与Xdebug配合,可按以下步骤操作:
- 安装Xdebug:在终端中运行
sudo apt-get update
和sudo apt-get install php-xdebug
。
- 配置php.ini文件:找到对应的php.ini文件,添加
zend_extension=xdebug.so
、xdebug.mode=debug
、xdebug.client_host=127.0.0.1
、xdebug.client_port=9003
、xdebug.idekey=PHPSTORM
等配置,然后重启Web服务器。
- 配置PhpStorm:打开PhpStorm,依次进入“File”>“Settings”>“Languages & Frameworks”>“PHP”>“Debug”,确保启用Xdebug,设置“IDE Key”为“PHPSTORM”,“Host”为“localhost”,“Port”为9003,还可设置其他参数。
- 设置断点:在PhpStorm的PHP文件中,单击行号旁边的空白处设置断点。
- 启动调试:在PhpStorm中点击“Start Listening for PHP Debug Connections”按钮(电话图标)或按Shift+F9,然后在浏览器中访问应用程序,若配置正确,代码会在断点处暂停,可进行调试操作。