Linux & Window: idea配置php+xdebug

xdebug problem using ide key [url]http://devnet.jetbrains.com/message/5265653[/url]
NetBeans结合xdebug调试php-fpm下的PHP代码 [url]http://www.48474.com/netbeans%E7%BB%93%E5%90%88xdebug%E8%B0%83%E8%AF%95php-fpm%E4%B8%8B%E7%9A%84php%E4%BB%A3%E7%A0%81.html[/url]
PHP xdebug only on localhost? [url]http://devnet.jetbrains.com/thread/286606[/url]

[color=red][size=x-large]Linux 配置:[/size][/color]
安装:
[b][color=darkblue]#sudo yum -y install php-pecl-xdebug[/color][/b]

配置php & xdebug
[b][color=darkblue]#sudo gedit /etc/php.d/xdebug.ini[/color][/b]
--------------------------------
[color=darkblue]; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
; see http://xdebug.org/docs/all_settings
[xdebug]
xdebug.profiler_enable=On
xdebug.auto_trace=On
xdebug.collect_params=On
xdebug.collect_return=On
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port= 9000
xdebug.remote_handler=dbgp
xdebug.idekey=php_debug[/color]

[b][color=darkblue]#sudo gedit /etc/php.ini[/color][/b]
--------------------------
[color=darkblue]zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=on
xdebug.remote_log=/var/log/xdebug.log
xdebug.remote_host=localhost
xdebug.remote_handler=php_debug
xdebug.remote_port=9000 [/color]


重启服务:
[color=darkblue][b]sudo systemctl restart mysqld.service
sudo systemctl restart nginx.service
sudo systemctl restart php-fpm.service[/b][/color]


[size=x-large][color=red]Window配置:[/color][/size]
[b]1.使用xampp[/b]. 下载并解压到某一个盘的根目录,假如不是根目录,那可能需要做其他配置。

[b]2.修改httpd.conf:[/b]
[color=darkblue]#DocumentRoot "/xampp/htdocs"
DocumentRoot "D:\work_documents\htdocs"
#<Directory "/xampp/htdocs">
<Directory "D:\work_documents\htdocs">[/color]

[b]3.修改php.ini:[/b]
[color=darkblue][XDebug]
;zend_extension = "\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port= 9000
xdebug.trace_output_dir = "\xampp\tmp"
zend_extension= "D:\DevTools\xdebug_dll\php_xdebug-2.2.3-5.5-vc11.dll"[/color]

[b]4.执行info.php[/b],可以看到xdbug模块被载入了。
[b]5.禁止一些调试和跟踪信息[/b],修改php.ini:
[color=darkblue]error_reporting = E_ALL&~E_NOTICE[/color]
接着重启apache服务器就ok了。

[size=x-large][color=red]配置idea编辑器:[/color][/size]
file--setting--php
A:[b][color=red]Interpreter[/color][/b]:点击Interpreter后面的"..."按钮,在Interpreters的左上角,点"+"按钮,
增加一个整合,选择"user/bin/php",修改名字"PHP-Interpreters",并在后面的下拉框选择[color=blue]xdebug[/color]。返回到配置页面,在Interpreter后面的下拉框选择"PHP-Interpreters"选项。
B:[color=red][b]Server[/b][/color]:点击中部的"+"按钮增加一个配置:name->PHP-Server; Host=>localhost; Port=>[color=blue]9000[/color](我改成80貌似也没问题); Debugger=:Xdebug;
C:[color=red][b]Debug[/b][/color]:在xdebug后面的端口,改成[color=blue]9000[/color];
D:[color=red][b]DBGp Proxy[/b][/color]:IDE Key=>PhpStorm1; Host=>localhost; Port=>[color=blue]9000[/color]; 不是必需
E:[color=red][b]配置运行[/b][/color],返回到编程的正常界面。在中间那里,点击配置环境的下拉框;选择Edit Configurations; 在左上角,点击"+"按钮,增加一个配置:[color=blue]name=>htdocs; Servers: PHP-Server; Ide key(session id)=>php_debug;[/color]
确定,回到界面来,运行:htdocs

浏览:最后在浏览器输入:
[url]http://localhost/info.php?XDEBUG_SESSION_START=php_debug[/url],
注意,一定加上:?XDEBUG_SESSION_START=php_debug, 就可以进入php的断点位置了
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值