Skip to content

Debugging WordPress with Eclipse PHP Development Toolkit

Requirements

Firstly, you need to insall XAMPP, and Eclipse (or and IDE with PDT support)

Configure PHP to Load Xdebug

Add these lines to your php.ini file (at c:\xampp\php\php.ini or somewhere else depending on your platform):

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1

Verify XDebug

Create a page called test.php in your web root folder, and add a call to the phpinfo() function:

<?php phpinfo(); ?>

Configure PHP Debug in Eclipse

  1. Create a new project using the location of the current WordPress location.
  2. Click the Debug drop down arrow and select Debug Configurations.
  3. Enter the following information as shown in the picture:
    Name—Type a name for the server.
    Debugger—Select XDebug.
    Base URL—Type the URL for your local domain test.
    Local Web Root—Set the path of your web root.

Configure PHP Debug

Test the Debugger

Add the following code to the function.php fine in the active theme of the WordPress installation. Then add a breakpoint and run the debug button.

add_filter( 'the_content', 'my_filter_content_func' );

function my_filter_content_func( $content ) {
  $words_replace = array('wordpress');
  $content = str_ireplace( $words_replace, 'MyBlog', $content );
  return $content;
}

Reference:
https://www.genuitec.com/debugging-php-with-eclipse-pdt/ https://eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf  

1 thought on “Debugging WordPress with Eclipse PHP Development Toolkit”

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.