在Debian上设置PhpStorm远程调试,可参考以下步骤:
sudo apt-get install php-xdebug
安装Xdebug扩展。/etc/php/7.x/apache2/php.ini
(根据实际PHP版本和Web服务器调整路径),添加以下内容:zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=本地IP地址
xdebug.client_port=9003
xdebug.idekey=PHPSTORM
sudo systemctl restart apache2
或sudo systemctl restart nginx
重启Web服务器。File > Settings > Languages & Frameworks > PHP
,在CLI Interpreter中添加SSH远程解释器。Deployment
中配置SFTP连接,设置本地与远程路径映射。Languages & Frameworks > PHP > Servers
中添加服务器配置,填写服务器名称、主机名、调试端口等信息。PHP > Debug
中,确保Debug port与php.ini中的xdebug.client_port
一致。XDEBUG_SESSION=PHPSTORM
参数即可触发调试。