Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I understand that you can put the GET variable XDEBUG_SESSION_START=1 in the URL to initiate a Xdebug session for that PHP page. However I want to debug a PHP that fires off when a form is submitted.

In JavaScript I could simply write debugger; anywhere inside the JavaScript (I do this a lot for AJAX response handlers) to have the browser dev tool break at that line. Can I do the same thing with PHP and Xdebug?

EDIT:

This is the setup I use:

PHP 5.4.14 (cli) (built: Apr 29 2013 01:59:13) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

I use MacVim - Custom Version 7.3 (66), which is actually just

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 23 2013 17:38:43)
MacOS X (unix) version
Included patches: 1-754
Compiled by [email protected]
Huge version with MacVim GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con_gui +diff 
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi 
+file_in_path +find_in_path +float +folding -footer +fork() +fullscreen 
-gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap 
+libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession 
+modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm 
+mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte
 +multi_lang -mzscheme +netbeans_intg +odbeditor +path_extra +perl 
+persistent_undo +postscript +printer +profile +python -python3 +quickfix 
+reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime 
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white 
+tcl +terminfo +termresponse +textobjects +title +toolbar +transparency 
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace 
+wildignore +wildmenu +windows +writebackup -X11 -xfontset +xim -xsmp 
-xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1  
Linking: clang   -L.   -L.        -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon      -lncurses -liconv -framework Cocoa    -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

And I use Vdebug for debugging on MacVim.

share|improve this question
    
Yes you can, for example eclipse and netbeans have integrated most of the features that xdebug offer –  dbf Apr 30 '13 at 19:50
    
@dbf Sorry, let me update what I actually use for Xdebug. –  hobbes3 Apr 30 '13 at 19:51
    
Are you a gray-bearded grumpy old man who still wants to relive the good old times using Vim in modern programming/script languages? :) From an OSX perspective I would recommend changing the IDE, I work with netbeans and eclipse (different projects) but both work very well under OSX. –  dbf Apr 30 '13 at 19:55
    
@dbf I just got used to VIM commands haha. Most of my coworkers actually use Sublime. –  hobbes3 Apr 30 '13 at 20:15
add comment

closed as too localized by hobbes3, hjpotter92, Pete, Omar, Stony May 15 '13 at 8:08

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

  1. Use Eclipse & PDT to debug
  2. Use Fiddler to intercept requests and change them
share|improve this answer
    
Only eclipse? :) –  dbf Apr 30 '13 at 19:54
    
It's what I use, so I know that it works. There are others that support it, but I'm not familiar with them. –  mbarlocker Apr 30 '13 at 19:55
    
I'll take a look at Fiddler thanks! –  hobbes3 Apr 30 '13 at 21:48
add comment

With any development IDE (i.e eclipse, Netbeans, komodo) you can set a breakpoint in the php point that process your form data

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.