aserwin
aserwin

Reputation: 1050

Netbeans and Xdebug in Linux

I have installed Xdebug, and I can confirm from phpinfo() that it is correctly installed. I have taken all the steps given in all of the sites that come up with I google "netbeans xdebug install, etc".

It still does not work in Netbeans. Is there any advice that someone can offer?

Here is my php.ini debug section...

[xdebug]
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_mode = "req"
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.idekey = "netbeans-xdebug"

Any help would be greatly appreciated!

Upvotes: 14

Views: 8276

Answers (4)

Khellus
Khellus

Reputation: 1

Make sure the remote port is set to 9000 in the xdebug.ini file, mine was set to 8000 and once I changed it, xdebug worked immediately.

Upvotes: 0

aserwin
aserwin

Reputation: 1050

The issue wasn't with the configuration of xdebug itself, but how I had NetBeans configured. It was a simple error... basically I was having NetBeans navigate to my /var/www/Application directory, which I hadn't actually set up yet.

Thanks to everyone for their help. I learned a lot about how xdebug works!

Upvotes: 0

moskito-x
moskito-x

Reputation: 11958

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.

enter image description here

enter image description here

Global settings:

Tools -- Options

enter image description here

enter image description here

PHP settings:

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

enter image description here

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

enter image description here

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

enter image description here

Make sure that the file is really there!

enter image description here

Make sure that the session.save_path is really there!

enter image description here

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".

enter image description here

Create a new Php Project:

enter image description here

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

enter image description here

Run Configuration

enter image description here

enter image description here

Start Debug: -- press Debug button

enter image description here

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)

enter image description here

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 enter image description here . If you forget this xdebug is running on.

Done:

enter image description here

Upvotes: 23

SlyChan
SlyChan

Reputation: 769

Try using xdebug.remote_connect_back=1 instead of xdebug.remote_host to avoid security issues

In fact,

zend_extension=path/to/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1

Must be enough.

Make sure that project properties->run configuration->advanced->do not open web browser option is NOT selected (in netbeans project config).

Also, check project url value in run configuration

Upvotes: 6

Related Questions