以下是Debian下配置PHPStorm的步骤:
安装PHPStorm
.tar.gz
)。/opt
):tar -xzf phpstorm-*.tar.gz -C /opt
。cd /opt/phpstorm-*/bin && ./install.sh
。配置环境变量(可选)
编辑~/.bashrc
或~/.zshrc
,添加:
export PATH=$PATH:/opt/phpstorm-*/bin
,然后执行:
source ~/.bashrc
。
配置PHP环境
sudo apt update && sudo apt install php php-xdebug php-cli php-fpm
。php.ini
(路径如/etc/php/8.2/cli/php.ini
):[xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.idekey=PHPSTORM
```。
sudo systemctl restart php-fpm
。配置PhpStorm
Settings -> Languages & Frameworks -> PHP -> Add
,选择PHP可执行文件路径(如/usr/bin/php
)。Settings -> Languages & Frameworks -> PHP -> Debug
,设置端口为9003
,IDE Key为PHPSTORM
。Settings -> Languages & Frameworks -> PHP -> Servers
,添加服务器(主机localhost
,端口80
,调试器Xdebug
)。其他实用配置(可选)
Settings -> Plugins
,搜索“Chinese”安装。Settings -> Version Control -> Git
。Settings -> Tools -> Deployment
。完成以上步骤后,即可在Debian下使用PHPStorm进行开发调试。