1. 程式人生 > 實用技巧 >PhpStorm 斷點除錯

PhpStorm 斷點除錯

一、準備工作

  1. 安裝 php7.0
  2. 安裝 phpstorm
  3. 安裝 xdebug2.4
  4. 安裝 chrome 外掛

二、Web 工程建立

  1. 新增 php 引擎
  2. 新增 web 訪問埠

php 引擎配置:phpStorm -> settings -> Languages & Frameworks -> PHP

PHP language level CLI Interpreter Name PHP executable
7.0 Add Other Local PHP 7.0 /usr/bin/php

web 訪問埠配置:phpStorm -> settings -> Languages & Frameworks -> PHP -> Servers

Name Host Port Debugger
PhpStorm 2018.1.7 PhpStorm 2018.1.7 63342 Xdebug

三、Web 斷點除錯

  1. 修改 xdebug 配置
  2. 修改 phpstorm 配置
  3. 啟動 chrome 外掛

xdebug 配置:vi /etc/php/7.0/mods-available/xdebug.ini

zend_extension=xdebug.so
xdebug.idekey="PHPSTORM"
xdebug.profiler_enable=1     
xdebug.profiler_output_dir="/tmp/xdebug"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host="localhost"
xdebug.trace_output_dir="/tmp/xdebug"

phpstorm 配置:phpStorm -> settings -> Languages & Frameworks -> PHP -> Debug

Xdebug Debug port DBGp Proxy Port
全選 9000 9001