Search code examples
phpnetbeansxamppxdebug

Debugging PHP, from NetBeans using XDebug and XAMPP


I have followed this document:

This is my php.ini

[XDebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000

I am running Apache using XAMPP on port 9000: enter image description here

from NetBeans when I do: Debug -> Debug Project

I get the following:

Port 9,000 is already in occupied. Configure the IDE to use another port?

enter image description here

XAMPP is the software that is using port 9000 thousand. What do I need to do here? Should I change the XDebug port to 9001? Tools -> Options:

enter image description here If I do this, I would also need to change php.ini and change the XDebug port to 9001.

Or should I keep using port 9000? I have been different settings, but not able to hit my break point.


Solution

  • This is how I got the debugger running:

    1. When prompted with:

    Port 9,000 is already occupied Configure the IDE to use another port?

    Click Yes (alternatively you can open the setting from Tools -> Options: Choose PHP -> Debugging)

    Set debugger Port to 9001.

    enter image description here

    1. update php.ini to have port 9001
    [XDebug]
    zend_extension="C:\xampp\php\ext\php_xdebug.dll"
    xdebug.profiler_enable = 1
    xdebug.profiler_enable_trigger = 1
    xdebug.remote_enable = 1
    xdebug.remote_host = "localhost"
    xdebug.remote_handler = "dbgp"
    xdebug.remote_mode = "req"
    xdebug.remote_port = 9001
    
    1. Restart XAMPP