Search code examples
phpbreakpointsnetbeans-11

Netbeans 11, X-DEBUG, CakePHP4 can't stop the php script on a breakpoint in a plugin controller


I am using NetBeans 11. I developpe a PHP application and plugin based on CakePHP 4.0 frameworks.

To debug my application I use X-DEBUG through NetBeans. The issue is that X-DEBUG ignores a breakpoint set in controller that belongs to my plugins.

X-DEBUG seems to be well configured because the php script stops on a breakpoint set in a controller that belongs to the main application I developpe.

The structure of the application follows cakePHP directives: application_folder plugins Controller Model … src Controller Model …

I try to add manually this at the end of the URL: ?XDEBUG_SESSION_START=netbeans-xdebug and refresh the page and the breakpoint in the plugin controller is taken in account and the script stop.

http://localhost/project_directory/plugin_name/controller_name/edit/1?XDEBUG_SESSION_START=netbeans-xdebug

What could be the problem? Is it a cakePHP problem or a X-DEBUG config problem or a NetBeans problem? Thank you for your answers Patrick


Solution

  • I resolved this issue myself by adding two lines in php.ini file in the X-Debug section.

    These two lines are: xdebug.remote_autostart=on xdebug.idekey="netbeans-xdebug"

    So my full X-debug section in my local php.ini file is like this:

    [XDebug]
    zend_extension=php_xdebug.dll
    xdebug.remote_autostart=on
    xdebug.remote_enable=on
    xdebug.remote_handler="dbgp"
    xdebug.remote_host="localhost"
    
    xdebug.remote_port=9000
    xdebug.idekey="netbeans-xdebug"
    

    And now all works fine...