What are best practices for debugging PHP

This is not necessarily a "best practice", but it worked for me and I can now step in PHP files and view variables. ;-)

I used the following software packages for testing:
- Apache HTTP server 2.2.17 on a W2K3 server standard (not R2, including all updates)
installed by installer, not manually with standard settings
- PHP 5.3.5 (VC9 x86 Thread Safe (2011-Jan-05 21:31:04))
installed by installer, not manually with standard settings

After installing PHP, I had to touch httpd.conf at the end, because the installer had forgotten to enter a few things. Here is the status after the PHP installation:
PHPIniDir ""
LoadModule php5_module "php5apache2_2.dll" and now after my manual intervention after the installation:
PHPIniDir "C: / Programs / PHP"
LoadModule php5_module "C: /Programme/PHP/php5apache2_2.dll"
After this small intervention I created a folder "phpdebugtest" in the document root of the web server and placed an index.php with the following content in it:
<?php phpinfo(); ?>
A short test with the local browser and the phpinfo was displayed as expected. So I was able to host PHP scripts on my "Quick 'n Dirty" web server.

Then I went to the XDebug website and they have a really great service there. It is important that the XDebug build matches the PHP build. That used to be extremely annoying to look for. Now it is much easier: Find-Binary
There you can simply insert the output of phpinfo () that was previously completely marked in the browser and start the analysis. The script then provides the correct download directly. It also describes where the file has to be copied and which line has to be added to the end of the PHP-INI. A final restart of the web server brought success, XDebug was installed.

I downloaded the latest PDT version from the Eclipse website:
Eclipse download page
I professionally ignored the information on the PHP debugger on this download page because I had already installed XDebug.

Eclipse PDT (stands for PHP Developments Tools) unpacked and started directly, confirmed the workspace, created a new PHP project called "phpdebugtest" and created the obligatory index.php. This time not with phpinfo but a loop in which I set a breakpoint. Here is the code snippet:
for ($ i = 0; $ i <10; $ i ++)
{
$ i ++;
echo 'This will be a breakpoint!';
}
?>
After I had copied this file to the web server and started the debug process, nothing happened at first. Strictly speaking, the process started up to 57% and then stopped. A connection to the debugger was awaited. I forgot to enable remote debugging in the PHP INI on the web server:
[XDebug]
xdebug.remote_enable = true
xdebug.remote_host = 192.168.1.50
At this point the debugger is informed whether and with which debug client it can / should connect. Restart the web server and start the debug process again in Eclipse - success!

Hope this helps to narrow down your problem or maybe even to solve it.