• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 619
  • Last Modified:

Setup xdebug for php debugging

I am having trouble setting up xdebug to respond to the debug request from the IDE I'm using (which is netbeans, but I really don't think the issue is with netbeans).

I installed xdebug through the pecl interface and it completed successfully. I created an xdebug.ini file in the ini include directory and have tried several different settings:
extension=xdebug.so
zend_extension="<fullpathtomodules>xdebug.so"
zend_extension_ts="<fullpathtomodules>xdebug.so"
zend_extension_debug="<fullpathtomodules>xdebug.so" -- which I don't think is going to work since php in configure with --disable-debug (this is possibly my issue, but I'm trying to avoid reconfiguring php)

I put the line xdebug.remote_enable=on in the ini as well.

The only way that the xdebug section shows up with phpinfo() is by doing just the extension=xdebug.so, but it still doesn't respond to the client debug request.

I did setup a working setup using a completely fresh install of all these, but that was using the local machine as the server. If any one has gone through this pain and has suggestions, I'm all ears.

vitals:
linux
apache2
php5.1.6
xdebug 2.0.4
0
MacAnthony
Asked:
MacAnthony
  • 9
  • 6
2 Solutions
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
Did you bounce the Apache httpd service?

Also, I recommend to see if the module is actually being picked up, try this: 'php -i | grep -i xdebug'

0
 
MacAnthonyAuthor Commented:
Yes, I restarted apache after each php.ini change. I'm pretty sure the module was loading correctly as it showed up in the phpinfo. I can't test that step out since this is a machine at work and I don't have access to it from home.

I did get the zend_extension to work by removing the quotes. One of the examples I saw used the quotes, but I think that is more for the windows platform.
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
I found this thread/post about how to use XDebug under PHP:

Squeezing code with xdebug
http://phplens.com/phpeverywhere/node/view/52

XDEBUG EXTENSION FOR PHP | DOCUMENTATION
http://www.xdebug.org/docs/remote
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
MacAnthonyAuthor Commented:
Thanks for the links. I had already scoured the xdebug documentation before I posted this though and the second link seems to just be covering usage. I think my issue is either a configuration or connection issue.
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
Is it possible to post a copy of a phpinfo() with the xdebug portion? Maybe something is being overlooked or part of the module is not fully enabled.
0
 
MacAnthonyAuthor Commented:
I don't think anything is really out of the ordinary since I only changed 1 or 2 options from the default. I do hope it's something simple I overlooked though.
xdebug.png
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
I setup a quick environment on my VMware server and got the same result as shown in your phpinfo() as well.

PhpInfo -- http://www.bitsbytesandbuns.com/info.php

I also tried reading over the XDebug documentation site (http://www.xdebug.org/docs/install), but it really doesn't make sense if you need --enable-debug or not. I tried a basic 'test.php' script using the modified var_dump() and it seems to be showing that the XDebug module is actually enabled.

Test Module #1 -- http://www.bitsbytesandbuns.com/test.php
Test Module #2 -- http://www.bitsbytesandbuns.com/test2.php

The only other document I found was in in relation to all of the settings XDebug understands:
http://www.xdebug.org/docs/all_settings

---

Even though you're using netbeans, have you tried Eclipse IDE and see how it reacts to the PHP/XDebug module?

Debugging PHP applications with xdebug
http://devzone.zend.com/article/2930-Debugging-PHP-applications-with-xdebug
0
 
MacAnthonyAuthor Commented:
xdebug is working in that regards on my system too. If I do a trigger_error, I get the xdebug error boxes and not the standard ones.

I did try turning off windows firewall temporarily to see if that was getting in the way, but it didn't help.

I did think about trying another client as there are a whole list of them that support this. I hadn't as of yet since there isn't much configuration on the netbeans side and thought the likelihood of that being the issue small. But I am going to go through that just as a test. I have zend studio installed and will try that (it's an eclipse based editor) just to rule it out as being a client issue.
0
 
MacAnthonyAuthor Commented:
Since you set it up yourself, have you tried getting the breakpoints or any of the other ide interactive features working in your instance?
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
Honestly, never played with an IDE before so it's new ground to me. My skillset is geared more on the backend of server environments. I will check with a couple of Drupal/PHP developers I work with and see if they have any background with XDebug and/or IDEs.
0
 
MacAnthonyAuthor Commented:
Apparently zend studio disables xdebug by default, but I found a work around to enable it.

I get the same result as with netbeans. It sits and waits for a response from the debugger and the page gets run without stopping at any of the breakpoints.
0
 
MacAnthonyAuthor Commented:
I'm 90% certain this is some config thing with either xdebug or the web server.  I just don't know how to debug that connection. It doesn't help that my setup at home where the client and the server are on the same machine, works flawlessly.
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
I checked with our PHP/Drupal develoeprs and it seems they don't use any IDEs, not even for testing. Strictly 'vi' and other built-in editors.

For your setup at home, have you considered something like virtualization (i.e. Xen, VMware) thus keeping the web server on one virtual build, while running the client environment from another?
0
 
MacAnthonyAuthor Commented:
They are in luck, there is a vim script to allow it to use xdebug :)

http://www.vim.org/scripts/script.php?script_id=1929

No, I haven't thought about putting it on a vm simply cause I don't really want to take the time to set that up just to test this out on my laptop. I do have another computer that I thought about setting up to try and debug from though.
0
 
MacAnthonyAuthor Commented:
Ok, got it fixed. Er at least I know what the issue was.

The xdebug.remote_host is the client connecting to the debugger. So it needs to be the host/ip address of the machine that is running the code.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now