PhpStorm 斷點除錯
阿新 • • 發佈:2020-08-10
一、準備工作
- 安裝 php7.0
- 安裝 phpstorm
- 安裝 xdebug2.4
- 安裝 chrome 外掛
二、Web 工程建立
- 新增 php 引擎
- 新增 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 斷點除錯
- 修改 xdebug 配置
- 修改 phpstorm 配置
- 啟動 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 |