1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Setting up the Debugger</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"><link rel="start" href="index.html" title="Debugging in PHP Eclipse"><link rel="up" href="ar03.html" title="Debugging a Project Locally Using PHPEclipse and XDebug"><link rel="prev" href="ar03s02.html" title="Creating a Simple Script"><link rel="next" href="ar03s04.html" title="Adding a Breakpoint"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Setting up the Debugger</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar03s02.html">Prev</a> </td><th width="60%" align="center">Debugging a Project Locally Using PHPEclipse and XDebug</th><td width="20%" align="right"> <a accesskey="n" href="ar03s04.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="phpeclipse.setupdebugger"></a>Setting up the Debugger</h2></div></div></div><p>Before we start debugging, we have to configure a few options so
2 that PHPEclipse and XDebug know where to find various components.</p><p></p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="phpeclipse.debugginglocal.setupdebugger.interpreterpath"></a>Specifying the PHP Interpreter Path</h3></div></div></div><p>To begin, we must specify the PHP Interpreter Path. This may
3 differ depending on your system. For Windows based systems, this is a
4 path to a file called php.exe. For Linux systems, this is a path to a
5 file simply called php. For Linux systems, this is often in
6 /usr/bin/php. To specify the PHP Interpreter, select Preferences from
7 the Window drop down menu. Open up the PHPEclipse selection and click on
8 XDebug. In the settings pane on the right that appears, enter your debug
9 port and the path to your PHP interpreter. The default debug port for
10 XDebug is 9000, but your system may be setup differently. To verify that
11 9000 is the correct port, find a way to access your phpinfo() page and
12 check the value of xdebug.remote_port. The value of xdebug.remote_port
13 should match the debug port value.</p><div class="figure"><a name="phpeclipse.debugginglocal.xdebugsetup"></a><p class="title"><b>Figure 1. XDebug Configuration Pane</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="xdebugsetup.png" alt="XDebug Configuration Pane"></div></div></div></div><p><br class="figure-break">When you have entered the appropriate values, click on the OK
14 button.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="phpeclipse.debugginglocal.setupdebugger.debugconfiguration"></a>Creating the Debug Configuration</h3></div></div></div><p>Now that we have configured XDebug, we need to create a debug
15 configuration. This will tell Eclipse how to start the debugger for your
16 project. To do this, select 'Open Debug Dialog' from the Run drop down
17 menu. You will be presented with a list of items which you can debug.
18 Double click on the entry titled 'PHP XDebug Script'. This will create a
19 new configuration and allow you to specify the necessary options. You
20 can provide a name for your debug configuration, and then you must
21 specify the filename which should be executed for debugging purposes. In
22 this case, the filename is index.php.</p><div class="figure"><a name="phpeclipse.debugginglocal.debugconfiguration"></a><p class="title"><b>Figure 2. Debug Configuration Window</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="debugconfiguration.png" alt="Debug Configuration Window"></div></div></div></div><p><br class="figure-break">When you have selected the appropriate file, click on the
23 Debug button to start debugging. After the program has finished, you
24 should see the Console window at the bottom of your screen. It will tell
25 you the status of your script (terminated in this case), and the output
26 below it (Loop0 Loop0 Loop1 Loop0 Loop1 Loop2 Loop0 Loop1 Loop2 Loop3
27 Loop0 Loop1). You have now successfully created a debug configuration
28 and are ready to use the debug tools to analyze your scripts.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ar03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ar03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Creating a Simple Script </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Adding a Breakpoint</td></tr></table></div></body></html>