温馨提示×

phpstorm centos远程调试配置

小樊
44
2025-09-03 18:29:34
栏目: 编程语言

以下是在CentOS上配置PhpStorm远程调试的步骤:

  1. 安装Xdebug扩展
    • 用命令sudo yum install php-devel php-pear安装必要工具。
    • 通过sudo pecl install xdebug安装Xdebug。
    • 编辑php.ini文件,添加zend_extension=xdebug.soxdebug.mode=debugxdebug.client_host=<本地IP>xdebug.client_port=9003xdebug.start_with_request=yes等配置。
    • 重启PHP-FPM或Web服务器。
  2. 配置PhpStorm
    • 配置PHP解释器:在Settings中选择Languages & FrameworksPHP,在CLI Interpreter处添加远程PHP解释器路径。
    • 配置服务器:在PHPServers中添加新服务器,填写名称、主机名、端口等,与php.ini中配置一致。
    • 配置Debug:在PHPDebug中,确保Debug portphp.inixdebug.client_port一致。
  3. 设置断点并启动调试
    • 在PhpStorm中打开项目,在代码行号旁单击设置断点。
    • 点击工具栏绿色虫子图标或按Shift+F9启动调试。

0