Netbeans and Xdebug in Linux

Netbeans and Xdebug in Linux

Since the information available to me is very sparse, I have to describe the settings in more detail.

Netbeans and xdebug settings.

Ubuntu 12.04 LTS Precise Pangolin

What ought to be installed.

Sample Image

Sample Image

Global settings:

Tools -- Options

Sample Image

Sample Image

PHP settings:

With phpinfo() you get.. see below image.

Sample Image

Only one php.ini is important ! Look at Loaded Configuration File
If you wrote a xdebug entry into another "php.ini" file be sure to clear all these entries again. ( xdebug ONLY in one php.ini ). Look also at Additional .ini files parsed. We come to this later.

zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000

Sample Image

Additional .ini files parsed.

Add or controlling, only the first line must be the same as in the "php.ini".( Without " " )

Sample Image

Make sure that the file is really there!

Sample Image

Make sure that the session.save_path is really there!

Sample Image

Control the xdebug version that should be equal to or greater.( Matching PHP Version-5.3.10-1 ). If everything was done as described in this answer, and it does not work, then it is with great probability of an incorrect or defective "xdebug.so".

Sample Image

Create a new Php Project:

Sample Image

Project Properties:

Sources

In our test program, it is important the Project Folder and Source Folder are exactly alike!

Sample Image

Run Configuration

Sample Image

Sample Image

Start Debug: -- press Debug button

Sample Image

The default Browser opens and remains at Connecting .. stand while Netbeans in debug mode is.

(If Netbeans do not open a Browser or can not connect, go back to Advanced Web Configuration and select Do Not Open Web Browser. Close an reopen the browser and type the URL as seen below)

Sample Image

Go through your code. You will see only something in the browser when you're done with the debugging. Don't forget to press the Stop Button Sample Image . If you forget this xdebug is running on.

Done:

Sample Image

Debugging PHP Project using XDebug with Netbeans Crashes

I solved the problem by clearing/deleting all files and directories at ~/.netbeans (I'm using Netbeans on Linux Ubuntu).

Removing the cache didn't solve the problem. Deleting netbeans project files didn't solve the problem.

Unable to use Xdebug 3.0.2 with NetBeans 12.2, PHP 7.4, Ubuntu 20.04

It's just black magic but anyway, it works. Thanks a lot

If it can help anyone, I hadded the xdebug.idekey to my .ini file and to have it running :

  1. In Netbeans I click on the "Debug Project" button, it starts waiting for xdebug
  2. In my browser (Chromium) I have to launch the url manually to start debugging

I tried using Firefox instead of Chromium for debugging and it's working as expected.

Debugging with Xdebug and Netbeans on Fedora

Install Xdebug:

sudo yum install php-pecl-xdebug.x86_64

Add this lines to php.ini at the end of /etc/php.ini

zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Add the same lines to /etc/php-zts.d/xdebug.ini:

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Allow port for Xdebug

sudo semanage port -a -t http_port_t -p tcp 9000

Now find your netbeans.conf file in your system:

sudo find / -name netbeans.conf

Now, open up the file and add the text “-J-Dorg.netbeans.modules.php.dbgp.level=400″ in netbeans_default_options so that the line looks somewhat like this:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m
-J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dsun.awt.disableMixing=true -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J-Dorg.netbeans.modules.php.dbgp.level=400"

Restart both NetBeans IDE and apache:

sudo service httpd restart

Xdebug and Netbeans are not communicating with each other

Whenever I install on a new Linux machine: "php xdebug" and netbeans
I run these simple steps and I've always managed to corect integration of xdebug on netbeans.

So with the data you provide, I can only help you solve, the half of your problem.
Allowing you to connect on Linux machines:

Installation with pecl:

# apt-get install php5-dev php-pear

# pecl install xdebug

Or direct installation:

# apt-get install php5-xdebug

find the library:

# find / -name 'xdebug.so'

/usr/lib/php5/20090626+lfs/xdebug.so

Edit phi.ini file:

...

zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so

xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

...

Restart web-server in your case: Apache

$ /etc/init.d/apache2 restart


According to what you have posted:

Installing Netbeans on Ubuntu 12.04 LTS.

I have used the installation method "apt-get" for distributions ".deb".
If you are using a distribution ".rpm" can do the same with "yum"

Many of these commands are surely simplified within the xampp.

But if you running this commands from console will not affect the final result.


Another important note about Windows's machines and Linux's machines,

You should check that your firewall rules are allowing to establish a connection from netbeans to xdebug.



Related Topics



Leave a reply



Submit