Quote from: BobRay at Mar 30, 2010, 11:40 PM
I am using PhpED’s debugger, but I don’t know how to use it outside of PhpED. I’ve used it many times to debug standalone PHP code by just loading it into PhpEd and executing it with debug on, but I’d like to debug my own snippets and plugins executed by MODx (and sometimes the MODx core code).
Okay, now I understand. Because of your
posting #12 I thought that you already do ’remote’ debugging.
I assume you have a local server that you can use instead of the one PhpED provides (e.g. XAMPP or a comparable environment that you set up yourself).
In your php.ini you should add these entries if you haven’t already done it:
[Zend]
zend_extension="C:\xampp\php\ext\dbg-php-5.3.dll"
[debugger]
debugger.hosts_allow=127.0.0.1
debugger.hosts_deny=ALL
debugger.ports=7869
Please substitute ’C:\xampp\php\ext\dbg-php-5.3.dll’ with the path to your debugger DLL that you copied from the PhpED installation directory (subdirectory debugger\server\Windows\your_php_version) to your PHP extensions directory. Restart the webserver. If you have the same problem with crashes as described in this thread, maybe it helps to deactivate the custom session handling as suggested in
posting #13.
In your project properties (’Properties’ tab, section ’Mapping’), you should set the run mode to ’HTTP mode (3rd party WEB server)’ and provide the root URL and the remote root directory (’remote’ meaning your
local server this time). It’s even easier when you use the Settings Wizard, then there’ll be some checks if everything is set up correctly.
The method using DebugBreak() I described should work directly now - just call a page in your browser that uses the snippet you’d like to debug.
Otherwise you’ll have to start the debug session explicitly. In my opinion, the easiest and most convenient way to do this is using the Firefox
DBGbar extension (I’m sure I read about something similar to this for IE, please search for it if that’s your preferred browser). Using DBGbar, you can choose what to debug (current page, next page, next form submit, start/end debug session), and you can also profile the current page. You can use breakpoints etc., but as I said, this doesn’t seem to work within snippets.
I’m sorry if this was too detailed - I’m sure you already set up most of the things I described.
If you need more information on some details, these links should help you:
HOWTO: Install debugger module
NuSphere PHP Debugger Wizard Script
Debugging PHP, JSON and JavaScripts Application using PHP IDE
Debugging with PhpED and DBG
Good luck!
Cheers,
Jan