Netbeans和XDebug用于调试Wordpress

时间:2012-03-04 09:37:29

标签: wordpress netbeans xdebug

我无法正常使用Netbeans和xDebug。 Acutaly debbuging工作正常但只有核心wordpress文件而不是我正在开发的主题文件。我在网上寻找解决方案,没有任何可行的方法。

当我开始调试时,netbeans会加载我的主题index.php文件,而不会转到我放弃的其他文件。

任何解决方案?

更新:我试过xdebug_break();但它现在只有在将它放在header.php文件中才会中断。这是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   文件:/// d:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/general-template.php.get_header:34   文件:/// d:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/home-template.php.include:10   文件:/// d:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/template-loader.php.require_once:43   文件:/// d:/Program%20Files/wamp/wamp/www/wordpress/wp-blog-header.php.require:16   。{的index.php主}:17

在我禁用“在第一行停止”选项之前,调试器显示此行$content = get_the_content();并且调用堆栈文件正在改变,就像它在那里工作但不会显示它。

1 个答案:

答案 0 :(得分:2)

这似乎与我面临的问题相同,也没有找到解决办法。

我设法解决了看xdebug日志的问题。

在一些主题文件(index.php和header.php)中设置一些breakpoits并开始调试。有可能看到这样的事情:

<- 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>

请注意,它识别wordpress根目录中的断点而不是/ wp-content / themes /。

所以我试图映射项目的执行。在项目属性&gt;运行配置&gt; Advanced ...,在Path Mapping上将Server Path和Path Project指向主题目录。

运行新的调试,breakpoits运行良好。