在Debian下使用PHPStorm进行远程调试,可参考以下步骤:
sudo apt-get install php-xdebug
安装Xdebug扩展。/etc/php/7.x/cli/php.ini
(版本号根据实际调整),添加以下内容:[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.idekey=PHPSTORM
sudo systemctl restart apache2
或sudo systemctl restart nginx
重启Apache或Nginx。File > Settings > Languages & Frameworks > PHP
,点击齿轮图标,选择Add
,选择SSH Interpreter
,输入远程服务器的IP、用户名和密码等信息。Build, Execution, Deployment > Deployment
,添加SFTP配置,填写远程服务器信息,并设置本地与远程目录的映射关系。Run > Edit Configurations
,添加PHP Remote Debug
配置,设置监听端口为9003,并确保与php.ini
中的配置一致。