Notice: Trying to get property 'nodeValue' of non-object in /home/bizmate_biz/www.bizmate.biz/plugins/system/scriptsdown/scriptsdown.php on line 123

Notice: Trying to get property 'nodeValue' of non-object in /home/bizmate_biz/www.bizmate.biz/plugins/system/scriptsdown/scriptsdown.php on line 123

Notice: Trying to get property 'nodeValue' of non-object in /home/bizmate_biz/www.bizmate.biz/plugins/system/scriptsdown/scriptsdown.php on line 123

Notice: Trying to get property 'nodeValue' of non-object in /home/bizmate_biz/www.bizmate.biz/plugins/system/scriptsdown/scriptsdown.php on line 123

Notice: Trying to get property 'nodeValue' of non-object in /home/bizmate_biz/www.bizmate.biz/plugins/system/scriptsdown/scriptsdown.php on line 123
Enable PHP Debugging - Eclipse XAMPP Chrome
Print

 

 

 

 

Please note this article has been changed to be flexible enough to allow set-up of Xdebug for any Xamp environment (Windows/linux/mac). Also it directs you to use the Chrome Xdebug plugin so you can control when Xdebug is enabled for your application straight from Chrome without changing your php configuration and restarting Apache.

These are the different steps required to get the installation working

  1. Install the Xdebug PHP module in your php.ini - download the Xdebug module and enable it in PHP
  2. in eclipse configure the debug options to use Xdebug as default debugging tool
  3. Install and configure Xdebug Chrome Plugin
  4. Test the whole functionality from the browser

 Go to the next page for detailed instructions on step 1.


 

 

 

 

 

  1. Find your current php settings by performing one of the following
    1. Create a page to display the phpinfo() and copy to clipboard the source of this page
    2. In the command line run php -i and cop the output to clipboard
  2. Go to http://xdebug.org/wizard.php , paste the settings collected at step 1 in the form and submit
  3. Follow the instructions on the Wizard and include the zend_extension entry in the php.ini . Do not restart your server yet
  4. Lets add the following instructions to make sure we set php to listen for the remote chrome plug
    xdebug.remote_enable=true
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp

  5. Restart the server and inspect again the PHP info for the page or from php -i from the command line, now you should see the Xdebug module enabled there similar to the screenshot below

Xdebug enabled in PHP.ini


 

 

 

 

 

 

  1. in eclipse set Preferences->PHP->Debug->Installed Debuggers->select Xdebug->Configure and set Accept remote session to "any" as per images below
    Eclipse PHP Xdebug selection

    Eclipse Configure Xdebug JIT to any

    Make sure Eclipse is pointing to the php executable and php.ini in the PHP Executable drop down, if none available it is because ou need to tell Eclipse where it is.
  2. in eclipse set Preferences->PHP->Debug disable Break at first line (no need to break at first line but rather make it run until first toggle/breakpoint)
  3. if your project is not set as php project make sure it is by modifying the project config, instructions here

 

 

 

 

 

I am not going to target Firefox in this page but I am sure that by this time there is a plugin also for other browsers.
As i use Chrome i had to install the plugin available from this page.

Once installed open it and configure it so that it is enabled for your domain

  1. Open the Chrome settings page for extensions configuration as shown in this image
    Chrome Extensions page/configuration

  2. Click on options and the Xdebug configuration page will open
    Add domains to the Xdebug plugin config
  3. Add your localhost domain or any other local domain you are using to the list of allowed domains on this page. For instance, in my settings above the plugin is enabled only for localhost and for wallet.dev

 


 

 

 

 

 

 

At this point we should be set to go ... both PHP, Eclipse and your Chrome Browser and plugin are ready for a run-time debugging session.

All you need to do now is

  1. In Eclipse, insert a breakpoint where you want to inspect the runtime code of your php application 
    Eclipse set a breakpoint
    Notice that there is a dot next to line 2 of the code above, if you want to include or remove a breakpoin just doubleclick on the side where the dot is supposed to appear.

  2. Enable the Xdebug plugin on Chrome, set it to Debug
    Xdebug plugin activate on Google Chrome
  3. Call the PHP page application from Chrome
  4. Now Eclipse should prompt you to switch to the Debug perspective, accept ... you can go back to the PHP perspective later if you want, and it will stop at your first breakpoint

You should now have all you need. If for some reason it is not working for you try to contact me from this site or google is your friend