在Debian上配置PHPStorm远程调试,可按以下步骤进行:
sudo apt-get install php-xdebug
。/etc/php/7.x/apache2/php.ini
(根据实际PHP版本调整路径),添加以下内容:[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug
xdebug.client_host=你的本机IP
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.idekey=PHPSTORM
然后重启Apache或Nginx,如sudo systemctl restart apache2
。
File > Settings > Build, Execution, Deployment > Deployment
,点击+
选择SFTP,填写服务器IP、端口、用户名、密码等信息,并测试连接。File > Settings > Languages & Frameworks > PHP > Debug
,选择Xdebug作为调试引擎,设置监听端口为9003。点击Run > Edit Configurations
,添加PHP Remote Debug
配置,输入服务器名称、IDE Key等信息。配置完成后,即可在PHPStorm中启动调试会话,在代码中设置断点进行调试。