以下是在Ubuntu上使用PHPStorm調試功能的步驟:
sudo apt-get update和sudo apt-get install php-xdebug,若使用特定PHP版本,需安裝對應版本擴展,如sudo apt-get install php7.x-xdebug。/etc/php/{php_version}/cli/php.ini或/etc/php/{php_version}/fpm/php.ini,添加zend_extension=xdebug.so、xdebug.mode=debug、xdebug.client_host=127.0.0.1、xdebug.client_port=9003、xdebug.start_with_request=yes,保存后重啟PHP和Web服務器。File > Settings,在Languages & Frameworks > PHP > Servers中添加新服務器,設置主機名、端口等;在Languages & Frameworks > PHP > Debug中確保Xdebug啟用且端口正確。Shift+F9,選擇服務器配置后啟動,代碼執行到斷點時會暫停,可查看變量、逐步執行代碼等。