Tech Blog :: Debugging PHP with XAMPP, MacGDPp, and Textmate


Jun 27 '10 11:05pm
Tags

Debugging PHP with XAMPP, MacGDPp, and Textmate

Technosophos has a great tutorial on setting up a PHP debugging environment with XDebug and MAMP. I'm using XAMPP and it works the same way, just change the path where xdebug.so goes.

However, the Textmate part - using the xdebug.file_link_format parameter - doesn't seem to be working. Apparently others are having the same problem, possibly Snow Leopard-related, not sure if there's a solution. It's not necessary for the debugger to work, however, just a convenient way to view the error-causing code.

I used the same method and had the same issue with the TextMate link. I haven't tried it yet, but someone named Jonathan Hodges commented on my post about it with code for Greasemonkey to fix the issue:
http://www.brockboland.com/2009/11/debugging-php#comment-851

Though I just noticed that the code got all jacked up by the markup checker, as I'm sure it will here, but you can probably see the original in the admin if I paste it here:

stripHTML = function(inputText)
{
// What a tag looks like
var matchTag = /<(?:.|\s)*?>/g;
// Replace the tag
return inputText.replace(matchTag, "");
};

linkup = document.getElementsByTagName('th')[0];
text = linkup.innerHTML;
f = text.substr(text.indexOf('/Volumes'), text.indexOf(' ', text.indexOf('/Volumes'))-text.indexOf('/Volumes'));
l = parseInt(stripHTML(text.substr(text.indexOf('line ', text.indexOf(f))+5,10)));

linkup.innerHTML = text.replace(f, '' + f + '');

theArray = document.getElementsByTagName('td');
i = 0;
for ( var item = theArray[0]; theArray.length > i; item = theArray[++i] )
{
if ((typeof item.title) != 'undefined' && item.title.indexOf('/Volumes') > -1) {
l=parseInt(stripHTML(item.innerHTML.substr(item.innerHTML.indexOf(':')+1,10)))
item.innerHTML = '' + item.innerHTML + '';

}
}