温馨提示×

phpstorm Ubuntu远程开发设置

小樊
52
2025-08-22 02:51:26
栏目: 编程语言

以下是在Ubuntu上进行PHPStorm远程开发的设置步骤:

  1. 安装SSH服务器(如未安装)
    • 打开终端,输入sudo apt update,然后sudo apt install openssh-server
    • 编辑配置文件sudo nano /etc/ssh/sshd_config,确保Port 22PermitRootLogin prohibit-passwordPasswordAuthentication yes未被注释,保存退出后sudo systemctl restart sshd
  2. 配置远程解释器
    • 打开PHPStorm,进入File -> Settings(或PhpStorm -> Preferences)。
    • 导航到Languages & Frameworks -> PHP -> CLI Interpreter,点击右上角齿轮图标,选择Add
    • 选择SSH Interpreter,输入远程服务器IP、用户名、密码或SSH密钥,点击Next,选择远程PHP解释器路径,完成添加。
  3. 配置远程文件同步
    • 进入File -> Settings(或PhpStorm -> Preferences)中的Deployment -> Configuration
    • 点击+按钮,选择SFTP(或FTP),填写服务器信息,设置本地与远程路径映射,点击ApplyOK
  4. 配置远程调试(可选)
    • 点击Run -> Edit Configurations,点击+选择PHP Remote Debug,配置调试端口、远程服务器IP等信息。
    • 在远程服务器的php.ini中启用Xdebug并设置相关参数,如xdebug.remote_enablexdebug.remote_host等。

0