PhpStorm+Xampp+Xdebug配置

来源:互联网 发布:淘宝客服每日工作总结 编辑:程序博客网 时间:2024/05/16 09:54

一、Xampp安装及配置

首先安装好xampp(个人安装文件在D:\Xampp)。

1.配置工作空间

打开文件 D:\Xampp\apache\conf\httpd.conf 更改属性DocumentRoot 后的参数至自己的工作空间(“D:/workspace/Php”),以后项目就放在这个文件夹里。

2.配置XDebug

Windows 环境下:
打开 D:\Xampp\php\php.ini 添加
[XDebug]
zend_extension = “D:\Xampp\php\ext\php_xdebug.dll”
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = “D:\Xampp\tmp”
xdebug.profiler_output_name = “cachegrind.out.%t-%s”
xdebug.remote_enable = on
xdebug.remote_handler = “dbgp”
xdebug.remote_host = “127.0.0.1”
xdebug.trace_output_dir = “D:\Xampp·\tmp”
xdebug.remote_port = 9000
重启 Apache
如果是Linux 需要下载 xdebug
http://code.activestate.com/komodo/remotedebugging/
解压后找到合适版本的xdebug.so并将其复制到/opt/lampp/lib/php/extensions/中。然后修改/opt/lampp/etc/php.ini文件,
在其最后加上

[XDebug]
zend_extension=”/opt/lampp/lib/php/extensions/xdebug.so”
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=”/opt/lampp/tmp”
lampp restart

2 PhpStorm

2.1 进入File>Settings>PHP>Servers,添加一个 Server

Name : localhost
Host : localhost
Port : 80
Debugger : Xdebuger2.2 进入File>Settings>PHP>Debug
Debug port : 90002.3 打开 Edit Configurations
这里写图片描述

添加一个 PHP Web Application
这里写图片描述

运行时 就用这个 Web 运行调试,搞定。
还不行就试试修改 上图中的Defaults,我把 server都改成了自己的localhost ,浏览器改成了firefox。
成果就是设置好断点,debug 运行,或者直接 shift + F9 则会自动打开火狐浏览器并且停留在断点处。

原创粉丝点击