简体   繁体   中英

Netbeans and XDebug for debugging Wordpress

I can't get working Netbeans and xDebug properly. Acutaly debbuging is working ok but only with core wordpress files not theme files which i am developing. 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.

Any solutions?

Update: I tried xdebug_break(); but it's now it will break only if am place it in header.php file. Here is 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

Before i disabled "Stop at first line" options debugger was showing this line $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.

Setting some breakpoits in some theme files (index.php and header.php) and started a debug. 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/.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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