How to setup PHP debugging in Eclipse – xDebug

The following video tutorial shows how to configure Xdebug delivered with XAMPP and how to use Eclipse PDT for debugging a sample php
project. The video is covered by the written instructions below, see them as addition, the video should be enough. One note to the end of the
video: The debugging is started twice, in the first debug pass you will see, that the website is not redirected to the php script receiving the
form data. That sometimes just happens, seems to be some kind of bug. On the second attempt everything works.


The tutorial uses XAMPP 1.7.3, Xdebug 2.0.6-dev, Eclipse PDT 2.2.0 All In Ones and Windows 7. It however should work the same on future
versions of the mentioned software. The written instructions assume that you install XAMPP to C: (the default suggested by the installer). Note
that the installer then creates C:xampp automatically.

1) Get XAMPP (the basic package, only this package includes Xdebug) from
http://www.apachefriends.org/en/xampp-windows.html. Install it to C:,
the installer will then automatically create C:xampp

2) After XAMPP has
been installed, open C:xamppphpphp.ini and perform the following
replacements:

replace
;zend_extension = “C:xamppphpextphp_xdebug.dll”
with
zend_extension = “C:xamppphpextphp_xdebug.dll”

replace
;xdebug.remote_enable = 0
with
xdebug.remote_enable = 1

3) (Re)start the apache webserver using the XAMPP Control Panel.

4) Get Eclipse PDT All In Ones from
http://www.eclipse.org/pdt/downloads/ and extract it to a folder of your choice. Start Eclipse and make sure to select C:xampphtdocs as workspace, else your files won’t be available to the apache webserver and therefore you can’t execute them. In the Eclipse menu choose Window
– Preferences, then PHP – Debug. Change the PHP Debugger from Zend Debugger to XDebug and uncheck “Break at First Line”. Click Apply and
then OK. The debugger is now set up. Time to use it! IMPORTANT: If you already had any debug configuration for a PHP project, make sure to
delete it, so that a new configuration with the new settings is created the next time you debug a php script! Debug configurations you’ve
created before changing the settings in this step won’t be automatically updated! This is a common source of errors!

5) (For this step I recommend you have a look at the video, it is easy but complex to describe).
If you haven’t already done it, choose the most right symbol with the arrow (Workbench) in the Eclipse welcome screen. In the Eclipse menu choose File – New – PHP Project. Enter a name for your project e.g. WebDebugTest and click Finish. Now download http://download.boulder.ibm.com/ibmdl/pub/software/dw/opensource/os-php-eclipse-pdt-debug_source.zip
, it includes a sample project (not done by me, it is from [1]) called “webDebugExample”. Select the three files from this folder and add them to your Eclipse project by using e.g. Drag&Drop (maybe have a look at the video if you don’t know how to do that). The file one should start from when using this sample is “enterGreeting.php”. This script then sends the data you input to its form to “results.php”. Set a breakpoint in the “results.php” on line 8, then make sure to select “enterGreeting.php” in eclipse and debug the project as PHP Web Page. After you have entered something in the form and choosen submit, the debugger should start. The debugger is used like the other typical debuggers you may know. If you want to see the output of the script, you have to continue it using the arrow symbol in the debugger. Note, that in some cases the displayed website won’t change from the input form to the output. This is why the debugging process is run twice in the video. This seems to be a bug using Eclipse PDT and XDebug.

How to setup VisualSVN Server and TortoiseSVN Client

1. Install TortoiseSVN Client

Install the above client from http://tortoisesvn.net/downloads.html which is a straight forward installation.

2. Install VisualSVN Server

Install this server from http://www.visualsvn.com/server/download/

Now open the server by clicking the icon from desktop etc and create a repository. After the repository is created right click its name in the right panel and click ‘Copy url to clipboard’. Right Click on the folder that you want to upload to this repository from your computer and from the context menu choose TortoiseSVN -> import and paste the url in the repository box. Click Ok to upload your code to the repository.

Now clicking on the same folder you can update, commit your changes.