在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中啟動調試會話,在代碼中設置斷點進行調試。