简体   繁体   English

Netbeans和XDebug用于调试Wordpress

[英]Netbeans and XDebug for debugging Wordpress

I can't get working Netbeans and xDebug properly. 我无法正常使用Netbeans和xDebug。 Acutaly debbuging is working ok but only with core wordpress files not theme files which i am developing. Acutaly debbuging工作正常但只有核心wordpress文件而不是我正在开发的主题文件。 I looked all over the web for solution and there is nothing that works. 我在网上寻找解决方案并没有任何效果。

When I start debugging netbeans loads my themes index.php file and won't go to other files where i put break. 当我开始调试netbeans加载我的主题index.php文件时,不会转到其他文件,我把它放。

Any solutions? 有解决方案吗

Update: I tried xdebug_break(); 更新:我试过xdebug_break(); but it's now it will break only if am place it in header.php file. 但它现在只有在将它放在header.php文件中才会中断。 Here is Call stack: 这是Call stack:

file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/header.php.xdebug_break:79 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/header.php.require_once:79 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.load_template:1114 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.locate_template:1090 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/general-template.php.get_header:34 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/home-template.php.include:10 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/template-loader.php.require_once:43 file:///D:/Program%20Files/wamp/wamp/www/wordpress/wp-blog-header.php.require:16 index.php.{main}:17 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/header.php.xdebug_break:79 file:/// D:/ Program%20Files / wamp / wamp /www/wordpress/wp-content/themes/whisper/header.php.require_once:79 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.load_template: 1114 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.locate_template:1090 file:/// D:/ Program%20Files / wamp / wamp / www / wordpress / wp-includes / general-template.php.get_header:34 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/home-template.php.include :10 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/template-loader.php.require_once:43 file:/// D:/ Program%20Files / wamp / wamp /www/wordpress/wp-blog-header.php.require:16 index.php。{main}:17

Before i disabled "Stop at first line" options debugger was showing this line $content = get_the_content(); 在我禁用“在第一行停止”选项之前,调试器显示此行$content = get_the_content(); and Call stack files were changing like it was working something in there but won't show it. 并调用堆栈文件正在改变,就像它在那里工作,但不会显示它。

This seems the same problem I was facing and also found no solution that worked. 这似乎与我面临的问题相同,也没有找到有效的解决方案。

I managed to solve watching the xdebug log. 我设法解决了看xdebug日志的问题。

Setting some breakpoits in some theme files (index.php and header.php) and started a debug. 在一些主题文件(index.php和header.php)中设置一些breakpoits并启动调试。 It is possible to see something like this: 有可能看到这样的事情:

<- breakpoint_set -i 68 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/index.php -n 40
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="68" state="enabled" id="36480002"></response>
<- breakpoint_set -i 69 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/index.php -n 58
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="69" state="enabled" id="36480003"></response>
<- breakpoint_set -i 70 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/header.php -n 20
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="70" state="enabled" id="36480004"></response>

Note that it recognizes the breakpoints in the root directory of wordpress instead of / wp-content/themes/. 请注意,它识别wordpress根目录中的断点而不是/ wp-content / themes /。

So I tried to map the execution of the project. 所以我试着映射项目的执行。 In the Project Properties> Run Configuration> Advanced..., on the Path Mapping pointed the Server Path and Path Project to the theme directory. 在“项目属性”>“运行配置”>“高级...”中,“路径映射”将“服务器路径和路径项目”指向主题目录。

Running a new debug the breakpoits worked perfectly. 运行新的调试,breakpoits完美运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM