XDebug - Install and configure with NetBeans

Submitted by editor on Sun, 01/24/2016 - 12:23
Question

How to install and configure Xdebug With an IDE (NetBeans, PHPStome ...) ?

Step 1. Install Xdebug
If not already ainstalled, Install Xdebug (I'ts already on the package WAML, LAMP, MAMP)
In Linux Debian/Ubuntu/Mint
# sudo apt-get install php5-xdebug

Step 2. Configure the server
Open php.ini and add:
[xdebug]
;The path to the xdebug extention , If not already added
;zend_extension=/usr/lib/php5/20090626/xdebug.so
;zend_extension=xdebug.so

xdebug.remote_enable=on
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000

;IP of your debuging computer (127.0.0.1 if you use a local server)
;NOTE : Ff you use a VirtualBox VM, Probably you can use the 127.0.0.1 IP
xdebug.remote_host=127.0.0.1
;A key to identify your IDE
xdebug.idekey="netbeans-xdebug"
xdebug.remote_connect_back=1

Step 3. Configure your IDE
On Netbeans, Project properties->Run Configuration -> Project Url (Set project URL

Step 4. Configure web browser
- Install xdebug extention on your web browser (On FireFox / Chrome ...)
- Configure with your IDE Key : netbeans-xdebug

Finally, (on NetBeans)

  • Add a BreackPoint (where you want !!!)
  • Run your project in debug mode (Ctrl + F5)
  • You can:
    • View Variables
    • Step over ( F8 )
    • Step Into ( F7 )
    • Step Out ( Ctrl + F7 )
    • Run to cursor ( F4 )
    • Continue ( F5 )

Tags

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.