jbeginners:ideTable of Contents
Integrated Development Environment - WindowsThese instructions were adapted from Malibu’s “Local workstation xampp/Elipse PDT/xdebug on WinXP from start to end” article. Install and configure the test serverStep 1: Download XAMPPYou can download xampp for Windows here: XAMPP 1.6.3a for Windows Step 2: Install XAMPPRun the installer. I will refer to the xampp home directory as <xamppHome> from here on. Step 3: Start XAMPP and testImportant Note: Apache uses Port 80, as does Skype as an alternative for incoming connections. If you use Skype, go into the Tools-Options-Advanced-Connection panel and deselect the Use 80 and 443 as alternatives for incoming connections option. If Apache starts as a service, it will take 80 before Skype starts and you will not see a problem. But, to be safe, disable the option in Skype. Double-click on XAMPP Control Panel shortcut on your desktop. At a minimum, you should see the Apache and MySQL services running. It’s also a good idea to check the “run as service” box to have these start up when windows starts. Swing a browser on your xampp machine to ‘http://localhost’ to test the installation. You should see a flashy splash screen. You might also want to put a file called phpinfo.php in your htdocs directory. You’ll want it to have the following contents: <?php phpinfo(); ?> Hit the page ‘http://localhost/phpinfo.php’ and you’ve just executed a php script that tells you all about your php installation. Step 4: Download xdebug server, install it and configure php.iniCopy the .dll file into the directories <xamppHome>/php/ext and <xamppHome>/php/extensions. In both <xamppHome>/apache/bin/php.ini and <xamppHome>/php/php.ini, make the following configuration changes: - set ‘implicit_flush = On’ - Comment out (type ; at beginning of the line) ALL the lines under [zend] except zend_extension_ts=”<xamppHome>/php/ext/php_xdebug-2.0.0-5.2.2.dll” - Add the following: [xdebug] xdebug.remote_enable=1 xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" Step 5: Restart xampp and test xdebugDouble click C:/xampp/restart_xampp.exe Now browse to http://localhost/phpinfo.php. You should see a section for xdebug. This means that the xdebug extension is running properly. Install and configure the IDEStep 6: Download Eclipse PDTEclipse PDT is a version of Eclipse that is bundled specifically for PHP developers. It’s a good place to start. I recommend the latest integrated test version. It is the ‘all-in-one’ package for your platform. It’s Java, so at it’s heart it is platform independent, but it uses widgets that are platform specific. A note about Java: It is very important to have the latest vm installed before trying to use Eclipse PDT. You can verify that you have the latest shiny version of Java by going to their web site. Step 7: Install Eclipse PDTUncompress the file you just downloaded. Somewhere inside there you will find a directory called ‘eclipse’. Move that one into your xampp install directory. Step 8: Download Eclipse xdebug pluginYou want the 'Prebuilt Binary V0.2.3'. This is the plugin that will allow us to configure Eclipse to use XDebug. Extract the file and move the two jar files within into the <xamppHome>/eclipse/plugins directory. It’s also a good idea to print out the pdf and read through it. There is a lot of good information there. Step 9: xdebug configuration within EclipseFire up Eclipse by executing the appropriate binary in <xamppHome>/eclipse. When it asks you about the workspace, change it to c:\xampp\htdocs. You can check the “Don’t ask me later” mark; it’s really easy to change again later.
When Eclipse starts, go to Window→Preferences.. PHP→debug. The pane should look like this. (Notice the xdebug section). I didn’t actually have to change anything here, as it’s all in the php.ini. Create a test projectStep 10: Create a PHP ProjectYou’re finally ready to debug a web-based PHP script. Without further ado, within Eclipse select File→New→Project.. Now PHP→PHP Project. For ‘Project Name’, enter ‘debugtest’ and then select ‘Finish’. You will see the project pop up in the PHP Navigator. Highlight the project. Select File→New→PHP File and name it phpinfo.php (ok I’m not feeling very original here). In the editing pane, make sure the file contents are: <?php phpinfo(); ?> Note: Newlines get ignored. Save the file. Navigate to http://localhost/debugtest/phpinfo.php. You should see the same info you saw before. Step 11: Configure your debug profileYou must now go into Eclipse and tell the xdebug plugin how to start a debug session so that you can catch a breakpoint in your new script. Select Run→Open debug dialog.. and double-click on ‘PHP Web Script with Xdebug’. NOTE: There must be menu items ‘PHP Exe script with XDebug’ and ‘PHP Web Script with XDebug’. If these aren’t there then something has gone wrong with the plugin installation. You will come to a dialog screen that looks like this: Under Script and Server, browse to the file phpinfo.php in project debugtest. Make sure the url field has http://localhost/debugtest/phpinfo.php. If it doesn’t, uncheck the box and edit it manually. This is important because it is the site that Eclipse will go to when you start your debug session. It’s important to note that the configuration you just created is exclusively for the debugtest project. You will have to repeat this procedure and create a new debug profile for every new project you start. These configurations are unique to each project so it makes sense to name them accordingly. Select ‘Apply’ and ‘Debug’. You should have seen your phpinfo output come up in the external browser. Now select the tab for phpinfo.php and right-click on the vertical bar between your phpinfo.php line numbers and the edge of the edit pane and select ‘Toggle Breakpoints’. You will see a blue circle appear, indicating that there is a debug breakpoint at that location. Click on the down-arrow next to the bug in the top toolbar and select the debug test session that you just created. You should now have caught your first breakpoint. Install additional pluginsStep 12: Install the Subclipse plugin.Within Eclipse, select Help→Software Updates→Find and Install.. Select ‘Search for New Features to Install’. Hit ‘Next’. Select ‘New Remote Site..’ Name: Subversion Url: http://subclipse.tigris.org/update_1.2.x Now on the main screen ensure Subclipse is checked. Hit ‘Finish’ and follow the instructions to install Subclipse. When you are done, you will have a ‘SVN Repository Exploring’. You can use it to connect to your repository and do all the operations you need to. |




