以下是在Ubuntu中使用PhpStorm和Xdebug的步骤:
sudo apt-get update和sudo apt-get install php-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
xdebug.idekey=PHPSTORM
sudo systemctl restart apache2;若用Nginx和PHP - FPM,运行sudo systemctl restart php{php_version}-fpm和sudo systemctl restart nginx。File > Settings,在Languages & Frameworks > PHP > Servers中添加服务器,设置主机名、端口等;在Languages & Frameworks > PHP > Debug中确保Xdebug启用,端口与php.ini一致。Run > Debug,选择服务器配置后点击Debug按钮。