#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Debug PHP code at run-time (step-over) with breakpoints


    What is the best and easiest way to debug PHP code at run-time (step-over) with breakpoints. So that I can view the values on run-time and can debug easily. So, I want to know which php server and IDE works well with XDebug and easiest to configure with those. To be honest, I have tried 3-4 times in my life in last 7-8 years staring from win XP to Win 7 to setup xdebug with an IDE and a server and have failed, now again I need it in Win 8. I believe I can do it this time with your help.

    I just want any IDE with any server to work with xdebug in Win 8, so that I can pause execution at a break-point and see values of the variables. I do not even want to change values at run-time, just need to see those.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,008
    Rep Power
    376
    that would be pretty handy!

    what I am using is something like;

    // top of script
    $debug = true;

    then at certain lines/actions

    debug ( "messag", $debug);

    //debug is a function that echoes the message depending on whether debug is set or not! to make it act like runtime, you could use $_GET['debug']
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,183
    Rep Power
    9398
    There's more to setting up debugging than installing XDebug, what with settings and potentially firewalls, but the Netbeans I use has never had problems with it.

    Pick a "server". Pick an IDE that supports XDebug. We'll figure out what you need to do after that.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0
    Originally Posted by requinix
    There's more to setting up debugging than installing XDebug, what with settings and potentially firewalls, but the Netbeans I use has never had problems with it.

    Pick a "server". Pick an IDE that supports XDebug. We'll figure out what you need to do after that.
    Thanks. Should I use Wamp or Xampp?
  8. #5
  9. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,183
    Rep Power
    9398
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0
    Originally Posted by requinix
    Doesn't matter.
    Just tried Wamp and it remains offline even restarting server from system tray several times.

    XAMPP gives error:
    12:34:33 AM [Apache] Problem detected!
    12:34:33 AM [Apache] Port 80 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID 3396!
    12:34:33 AM [Apache] Apache WILL NOT start without the configured ports free!
    12:34:33 AM [Apache] You need to uninstall/disable/reconfigure the blocking application
    12:34:33 AM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    12:34:33 AM [Apache] Problem detected!
    12:34:33 AM [Apache] Port 443 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID 3396!
    12:34:33 AM [Apache] Apache WILL NOT start without the configured ports free!
    12:34:33 AM [Apache] You need to uninstall/disable/reconfigure the blocking application
    12:34:33 AM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    12:34:33 AM [Apache] Attempting to start Apache app...
    12:34:33 AM [Apache] Status change detected: running
    12:34:33 AM [Apache] Status change detected: stopped
    12:34:33 AM [Apache] Error: Apache shutdown unexpectedly.
    12:34:33 AM [Apache] This may be due to a blocked port, missing dependencies,
    12:34:33 AM [Apache] improper privileges, a crash, or a shutdown by another method.
    12:34:33 AM [Apache] Press the Logs button to view error logs and check
    12:34:33 AM [Apache] the Windows Event Viewer for more clues
    12:34:33 AM [Apache] If you need more help, copy and post this
    12:34:33 AM [Apache] entire log window on the forums

    So, I believe I will php a try in year 2020. May be things would be better then.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0
    Update: XAMPP server working fine now. Now I will try xdebug with phpstorm and netbeans.
  14. #8
  15. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    Erm...
    Your Skype is running a webserver? (ports 80/443)

    Never heard of that one.
    LinkedIn: Dave Mittner
  16. #9
  17. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,183
    Rep Power
    9398
    Originally Posted by dmittner
    Erm...
    Your Skype is running a webserver? (ports 80/443)

    Never heard of that one.
    No webserver. Skype uses those ports because they are less likely to be blocked than others, since Skype needs inbound connections. Nowadays it tries to use others but will still fallback to those if it can't.
  18. #10
  19. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    Originally Posted by requinix
    No webserver. Skype uses those ports because they are less likely to be blocked than others, since Skype needs inbound connections. Nowadays it tries to use others but will still fallback to those if it can't.
    Strange. With the number of ISPs that forbid webhosting over residential connections, I'd figure that 80/443 would be among those most likely blocked.

    Anyway, non-topical. Just struck me as a potential misconfiguration/security concern.
    LinkedIn: Dave Mittner
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,008
    Rep Power
    376
    also if you had installed WAMPSERVER it has a setting whereby you can enable xdebug straight away!

IMN logo majestic logo threadwatch logo seochat tools logo