Verification: a143cc29221c9be0

Netbeans php xdebug php ini

Netbeans php xdebug php ini

Daniel Opitz

03 Dec 2020


  • XAMPP for Windows:
  • Microsoft Visual C++ Redistributable for Visual Studio 2015-2019


  • Download Xdebug for the specific PHP version:
    • PHP 8.0 (64-Bit):
  • Move the downloaded dll file to: C:\xampp\php\ext
  • Rename the dll file to: php_xdebug.dll
  • Open the file C:\xampp\php\php.ini with Notepad++
  • Disable output buffering: output_buffering = Off
  • Scroll down to the [XDebug] section (or create it) and copy/paste these lines:
  • Restart Apache


  • Enable the Xdebug option: “Can accept external connections” and “Additionally listen on Xdebug 3 default port 9003”. Screenshot
  • Use the PhpStorm bookmarklets generator to activate Xdebug from the browser side.


  • Change the Netbeans debugging options: Screenshot

Visual Studio Code

  • Installing XDebug on anything for VSCode in 5 minutes
  • Install the PHP Debug Adapter for Visual Studio Code.
  • Debug PHP In VSCode With XDebug


Add XDEBUG_SESSION_START=PHPSTORM as query parameter to the url, e.g.


Start debugger from the console

Enter cmd:

set XDEBUG_CONFIG="idekey=xdebug"
php test.php

Download & installation

Download & installation of Xdebug is done by the following command:

pecl install xdebug


To "tell" your Apache web server about it, append to /etc/php5/apache2/php.ini file (this location may vary under other distributions) the following lines:

zend_extension="/etc/php5/xdebug/" ; make sure this path exists in your filesystem. If not, find file and put its path here

Open Netbeans and navigate to Tools --> Options --> PHP --> Debugging. Make sure the "Debugger port" & "Session ID" configuration values match the values of "xdebug.remote_port" and "xdebug.idekey" from the Apache php.ini file, respectively. In our example we set them to "9000" & "netbeans-xdebug".

Also, in your project properties select "Run Configurations" And make sure your project url is set in the right field.

Set some breakpoint at an interest point in your code by clicking on the line number in NetBeans.

Restart the Apache web server:

 sudo service apache2 restart

If you wish to be able to debug your project via the command line, add to /etc/php5/cli/php.ini file the same lines you added to /etc/php5/apache2/php.ini, and run the following commands:

sh -c "echo 'export XDEBUG_CONFIG=\"idekey=netbeans-xdebug\"' >> /etc/profile"
source /etc/profile

All that's left on NetBeans is to navigate to Debug --> Debug Project. Now you can go to your project by surfing to it using the browser or by running the specific php file in the command line. Notice your breakpoint should then hit.

1. Remote server configuration

1.1, install xdebug

1.1.1, download

[[email protected] ~]

1.1.2, unzipped

[[email protected] ~]

1.1.3, installation

[[email protected] ~]
[[email protected] xdebug-2.9.7]
[[email protected] xdebug-2.9.7]
[[email protected] xdebug-2.9.7]

1.2, configure pHP.ini

[[email protected] ~]
  • The file is not tail plus the following code
zend_extension = /usr/local/webserver/php/lib/php/extensions/no-debug-zts-20180731/

;Allows remote to be ON or 1  Both express, OFF and 0  Referring to close closing

;IP of the remote host We are filled in, fixed 
xdebug.remote_host =

;Remember this port after debugging the connection port and will be used. This configuration item defaults to 9000  Usually 9000  The port is occupied by FPM, so the port is replaced.
;Also, please open this port in your server's control panel and server firewall.
;If you are a pagoda panel, please release this port.
xdebug.remote_port = 9079

;The next value is optional, but I recommend you to use
;Key to connect IDE, remember him, you can customize yourself, mainly used to filter the request.

;Whether to open remote debugging automatic start

1.3, set environment variables

[[email protected] ~]
  • The file is not tail plus the following code:
export PHP_IDE_CONFIG=""

2, PHPSTORM IDE configuration

2.1、File->Settings->Languages & Frameworks > PHP

2.1.1 Configuring CLI Interpreters

2.1.2, code mapping

2.2、File->Settings->Languages & Frameworks > PHP > Debug

Note: The configured configuration in the Debug Port and the remote server here

2.3、File->Settings->Languages & Frameworks > PHP > Server

2.4、Add Run/Debug Configuration