[英]Netbeans + Xdebug + php not working
我的netbeans使用xdebug不能使用断点,我的配置看起来是正确的,所以我第一次配置我第一次停止调试,从那时起从未工作,有人有这个问题吗? 我的netbeans的版本是6.8,php的版本是2.5.2。
我的php.ini:
zend_extension_ts = d:\wamp\bin\php\php5.2.5\ext\php_xdebug-2.0.2-5.2.5.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.profiler_enable=1
在我的情况下,这行必须包含在php.ini中:
xdebug.remote_autostart=on
以下是XDebug的配置部分:
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.remote_autostart=on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"
xdebug清单:
phpinfo()
加载了xdebug,并且运行时值与预期配置匹配 。 xdebug.remote_enable
已on
。 on
xdebug.extended_info
以使断点起作用。 xdebug.remote_port
必须与ide相同且未使用 。 xdebug.remote_handler
是dbgp
。 xdebug.remote_autostart
则应将xdebug.idekey
设置为与ide的键相同 。 xdebug.remote_host
设置为Intranet IP或计算机名称而不是本地IP 127.0.0.1会有所帮助。 防火墙必须允许 PHP连接到此主机和端口。 xdebug.remote_log
设置为文件将有助于检查错误。 调试工作后禁用日志。 示例配置:
[xdebug]
xdebug.extended_info=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"
NetBeans清单:
(大多数默认选项都是开箱即用的,所以如果你绝望,请尝试删除并重新创建项目。)
在PHP 5.5和xdebug 2.2上测试的错误指令 :
output_buffering
不需要关闭。 (但可能有助于调试) xdebug.profiler_enable
。 如果你发现了新的东西,请编辑这个答案。
如果您仍然卡住,可以尝试以下方法:
xdebug.idekey=netbeans-xdebug
。 始终确保重新启动Apache服务以测试所有内容。
zend_extension = "C:\\xampp\\php\\ext\\php_xdebug-2.2.3-5.4-vc9.dll"xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"xdebug.remote_host = "localhost" xdebug.remote_port="9000" xdebug.remote_mode=req xdebug.trace_output_dir = "C:\\xampp\\tmp" xdebug.idekey="netbeans-xdebug"
这对我有用..
以下是我能够使用多个PHP-FPM自制软件安装工作的方法。
我将这篇优秀的文章用于多个安装:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
在该帖子的评论中,您将看到建议如何安装xdebug, 底线:
brew install php56-xdebug
您必须为已安装的每个PHP版本安装xdebug。 Homebrew会为你安装的每个版本的php制作一个xdebug.ini文件。 每个人都有一条路径:
/usr/local/etc/php/<version # i.e. "5.6">/conf.d/ext-xdebug.ini
本文安装在xdebug的默认端口(9000)上运行的DNSMasq,因此您需要将xdebug端口更改为其他端口(9001工作正常。)
编辑上面提到的ext-xdebug.ini文件(如果安装了多个版本的php,则编译文件。)这对我有用:
[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
; General config
; Dumps local variables on exception
xdebug.show_local_vars=On
; Dump server variables
xdebug.dump.SERVER=*
; Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;
; Tracing
;xdebug.auto_trace=On
;xdebug.trace_output_dir= /opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On
; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1
: from http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
前两行都是原始自制文件中的所有行。
顺便说一句 - 当我安装多个PHP版本时,这个ext-xdebug.ini文件只是为我安装的第一个PHP版本创建的。 我只是将此文件复制到其他PHP版本位置,并更改了第2行中路径的“php56-xdebug”部分以反映正确的php版本。
注意“xdebug.remote_port = 9001”
然后在Netbeans(我使用8.02 Mac osX10.10.3)我使用以下设置。 转到首选项 - > PHP->调试
调试器端口: 9001
停在第一线:( 未选中 )
手表和气球评估:( 检查 - 有警告,但它对我来说很好。)
另外值得注意的是,为了让xdebug显示使用phpinfo()(或命令行php -i),我需要重启apache:
launchctl unload -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
sudo apachectl restart
launchctl load -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
出于某种原因,我的设置要求我每次启动时运行它。 有点痛苦,但我将它合并到一个shell命令中,以便在版本之间轻松切换。
还有一个提示:brew信息php56的一部分说:
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using
the brew version you need to make sure /usr/local/sbin is before /usr/sbin
in your PATH:
PATH="/usr/local/sbin:$PATH"
在我将此添加到我的.profile_bash文件之前,我对每个版本的php-fpm.conf文件所做的更改无法识别。 其他一切似乎都有效,所以令人困惑。
希望这可以节省别人的时间和麻烦。
(由于评论中的格式无法正常工作,我回复了答案)
同样的事情发生在我身上:工作一次然后停止。 但是,我在配置中达到了一个点,它开始工作没有问题,我可以分享。
首先,我移动了离线立方体加载器的php.ini:
[PHP]
zend_extension=/Applications/MAMP/bin/php5/zend/lib/ioncube_loader_dar_5.2.so
然后我将这些行放在xdebug配置中:
[xdebug]
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
并评论了Zend Optimizer的所有内容
[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
;zend_optimizer.version=3.3.3
我在MAMP工作,这就是为什么我的库的路径被引用到我的MAMP文件夹。
祝好运
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.