以下是在CentOS上配置PhpStorm遠程調試的步驟:
sudo yum install php-devel php-pear
安裝必要工具。sudo pecl install xdebug
安裝Xdebug。php.ini
文件,添加zend_extension=xdebug.so
、xdebug.mode=debug
、xdebug.client_host=<本地IP>
、xdebug.client_port=9003
、xdebug.start_with_request=yes
等配置。Settings
中選擇Languages & Frameworks
→PHP
,在CLI Interpreter
處添加遠程PHP解釋器路徑。PHP
→Servers
中添加新服務器,填寫名稱、主機名、端口等,與php.ini
中配置一致。PHP
→Debug
中,確保Debug port
與php.ini
中xdebug.client_port
一致。Shift+F9
啟動調試。