Avatar of Camillia
Flag for United States of America asked on

Debugging PHP code

I have WAMP, NetBeans and phpMySQL. I want to debug the code in netbeans on my local machine.

I click the debug button, page comes up with this URL


But I get a msg at the bottom of netBeans "waiting for connection..". Debugger doesnt stop at the debug lines...
I found this link and I get the pop-up msg at the end of this link when I stop the debugger.

There's a script that the link says to run to open port 9000 but that link isnt found.

I followed the steps in that link. I've attached a screenshot. Any other ideas why the debugger doesnt stop at debug lines? What is that script that should be run?

This is in my PHP.ini. I've attached my screenshots as well.

I even tried this

and this


; XDEBUG Extension

zend_extension = "c:/wamp/bin/php/php5.4.3/zend_ext/php_xdebug-2.2.0-5.4-vc9-x86_64.dll"

xdebug.remote_enable = on
xdebug.profiler_handler = dbgp
xdebug.remote_host = localhost:88
xdebug.profiler_host = localhost:88
xdebug.profiler_port = 9000
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

Open in new window

Apache Web ServerPHP

Avatar of undefined
Last Comment

8/22/2022 - Mon
Ray Paseur

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

I totally understand what you're saying. I'm setting up my environment and wanted to step thru the code and that's how I came across xDebug...

You know what was wrong with that phpMySQL question I had and why I couldnt understand how it connects to the database? The orig developer has admin's userid/pwd harcoded in the code and just gives access to the admin user without any database hits, any validation. I .Net, I use Membership which hits the database for userid/pwd validation..

I'm creating test PHP code..using echo and watching tuotrials. Been reading about xDebug and that it's not easy thing to set up. I'll take a look at those books you've listed.

works now. I had localhost:88 in php.ini. I should only have localhost.
Ray Paseur

Glad to see it's getting pointed in the right direction!

On the subject of "stepping through the code," I totally get it.  A couple of years ago I had a development project on a server that was misconfigured -- it could not produce any error messages.  A PHP parse error equaled a white screen.  Even a PHP message equaled a white screen.  So any error, no matter how trivial, caused a trip back to the drawing board.  My response was to write my code in tiny bits, one or two lines at a time.  To my utter amazement, I found myself to be an order of magnitude more productive when measured by lines of executable code over time.  What I had never realized before that exercise was that I spent much more time debugging than I spent coding.  And when I changed my work habits so that I was going forward in baby steps, I found that I almost never had to debug anything.

So today my creative process is underpinned by (1) good test cases and (2) lots of data visualization and (3) step-wise incremental development.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

Good advice. I like #3....
Well, this is weird. I have 2 projects. One has one file "index.php" with one line of code. I can debug that (this wasnt working but now it works)...

 The other one, nope, still cant debug it! Same error as before for the larger project. I inherited this code. I wonder if I should create a new project and add files back to it, one by one. Dont know.

I added a new php page to the project with 2 lines
echo 'test1';
echo 'test2'

Made the new page as the default and xDebug stops and the debug works.

I'll open another question for this. It's weird.
Ray Paseur

Thanks for the points and thanks for using EE, ~Ray
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Figured it out just in case someone has the same issue. I added debug extension for Chrome. It adds a debug addon on top. I brought up the page and that add-on is disabled. I click it to enable it (turns green) and that's when the debugger stops at breakpoints.