在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
中的配置一致。