配置phpstorm + xdebug 调试php

    安装phpstorm,注册码什么的对天朝来讲不是四儿。php

    获取xdebug:git clone git://github.com/xdebug/xdebug.gitlinux

    cd到目录下,使用phpize将其添加为动态扩展,git

    报错,Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.github

    因而乎,brew install autoconf安装。phpstorm

    再phpize成功,以后编译文件:this

    ./configure --enable-xdebug && make && make installdebug

    小解释下,linux下的C文件,./configure是检查平台目标特征,--prefix参数指定软件安装在参数文件夹下,可执行文件在文件夹下bin目录里,若不写默认在/usr/bin。--enable启动些默认关闭的特性。make是编译make install是安装,都经过makefile来指定orm

    编译完成获得xdebug.soip

    修改php.ini,添加节点:rem

    [Xdebug]
 zend_extension="/Users/guoguo/xdebug/xdebug-2.4.0/modules/xdebug.so"
xdebug.remote_enable = on
;xdebug.remote_handler=dbgp
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.remote_autostart = on

    实际使用中发现MAMP下的php中已有注释掉的[xdebug],打开便可用,后装配的反而不能用,待考证。

 

    打开phpstorm,打开phpstorm->preferences->Languages&Frameworks->php,添加一个解释器interpreter,选到php程序,刷新可看到Debugger由None变成Xdebug,便可使用

相关文章
相关标签/搜索