1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- jEdit buffer-local properties: -->
3 <!-- :indentSize=2:noTabs=true: -->
4 <!-- :xml.root=docmaster.xml: -->
6 <sect1 id="sec.install_debugger">
7 <title>Installing Debugger</title>
9 At the moment only DBG is supported by the standard &phpeclipse; release. <application>XDEBUG</application> is only supported by loading the appropriate sources via CVS.
13 <sect2 id="sec.install_dbg">
14 <title>Installing <application>DBG</application></title>
15 <para><indexterm><primary>install</primary><secondary>DBG</secondary></indexterm>
16 DBG is a full-featured php debugger engine, an interactive tool that helps you debug PHP scripts. It works with a production and/or development web server and allows you to debug your scripts locally or remotely, from an IDE or the console. &phpeclipse; has a built-in, pure Java debugging client that operates the DBG debugging engine.
20 To get the debugger to work you need to install the debugger engine to run in the PHP interpreter, and configure the debugger client to communicate with the engine.
24 Make sure you download the appropriate DBG binaries for your OS and your release of PHP (from 4.0.6 up to 4.3.10 and from 5.0.0 up to 5.0.3) (Note that the 5.0.3 debugger binary seems to work for the 5.0.4 and 5.05 interpreters.) If you are using Mac OS X you will have to build the debugger from source.
28 <sect3 id="sec.find_dbg_dll">
29 <title>Getting the right php_dbg.dll</title>
31 DBG can be downloaded from <ulink url="http://dd.cron.ru/dbg/downloads.php">DBG Downloads</ulink>. You need to download the dbg modules packet for the appropriate operating system. Unpack the zipped packet and take the dll (or so) file which matches the PHP version you have currently running. E.g. for PHP 5.1.2 the correct file is <filename>php_dbg.dll-5.1.2</filename>. Rename the appropriate file to <filename>php_dbg.dll</filename> and read <xref linkend="sec.find_extension_dir"/> to find out the right destination location for the file.
36 <sect3 id="sec.find_extension_dir">
37 <title>Find the extension directory</title>
40 The best way to find out is via the <quote>phpinfo()</quote> command. Create a PHP-file called <filename>phpinfo.php</filename> with the following content:
41 <programlisting><![CDATA[<?php phpinfo(); ?>]]></programlisting> and start it via your web browser. Then search for <quote>extension_dir</quote>. The right column shows the path to the directory where you have to place the <filename>php_dbg.dll</filename> (see <xref linkend="fig.extension_dir"/>).
44 <figure id="fig.extension_dir">
45 <title>The information about the extension directory</title>
47 <imageobject role="html">
48 <imagedata align="center" fileref="img/en/xo-002/extension_dir_1.png" format="PNG"/>
50 <imageobject role="fo">
51 <imagedata align="center" fileref="img/en/xo-002/extension_dir_1.png" format="PNG" width="12cm"/>
58 <sect3 id="sec.install_dbg_php_ini">
59 <title>Setup &phpini;</title>
61 Where is the &phpini; which needs to be set up?
65 The simplest way to find out the path of the &phpini; is again with the help of the phpinfo function as described in <xref linkend="sec.find_extension_dir"/>
70 Another possibility to find out where an application searches specific files is by using a tool called <application>Filemon</application> which you can get from <ulink url="http://www.sysinternals.com">Sysinternals</ulink>.
75 The resulting output shows the path of the &phpini; file within the topmost header. See <xref linkend="fig.php_ini_path"/>
79 Now open <filename>php.ini</filename> and search for <quote>implicit_flush</quote>, and set it to <quote>On</quote>.
80 <programlisting><![CDATA[; this is to see output while debugging
81 implicit_flush = On]]> </programlisting>
85 copy the following lines into <filename>php.ini</filename> (they can go at the end of the file). For linux it is a php_dbg.so instead of php.dbg.dll.
86 <programlisting><![CDATA[
90 debugger.profiler_enabled=on
91 debugger.hosts_allow=localhost
92 debugger.hosts_deny=ALL
93 debugger.ports=7869, 10000/16
98 Disable <ulink url="http://eaccelerator.net">eAccelerator</ulink> if it is installed and enabled:
99 <programlisting><![CDATA[eaccelerator.enable="0"]]></programlisting>
103 Disable the <ulink url="http://xdebug.org/">Xdebug</ulink> extension if installed (usually via pear) by commenting out
104 <programlisting><![CDATA[;zend_extension=/usr/lib/php4/20020429/xdebug.so]]></programlisting>
107 Also if you have Zend Extension Manager installed (You should find a [Zend] section) make sure you add this line before any other zend_extension_ts (windows) or zend_extension (linux) lines: For Windows:
108 <programlisting><![CDATA[zend_extension_ts = "C:\path\to\php_dbg.dll"]]></programlisting>
110 <programlisting><![CDATA[zend_extension=/var/lib/php4/dbg.so]]></programlisting>
117 <figure id="fig.php_ini_path">
118 <title>Get the &phpini; path</title>
120 <imageobject role="html">
121 <imagedata align="center" fileref="img/en/xo-002/phpinfo_php_ini.png" format="PNG"/>
123 <imageobject role="fo">
124 <imagedata align="center" fileref="img/en/xo-002/phpinfo_php_ini.png" format="PNG" width="12cm"/>
131 <sect3 id="sec.install_dbg_test">
132 <title>Test the DBG Installation</title>
134 When you have done all steps, restart your web server and again submit the <function>phpinfo</function> function as described in <xref linkend="sec.find_extension_dir"/>. Search the browser output for <quote>dbg</quote> and you should find a section like you can see in <xref linkend="fig.test_dbg"/>
137 <figure id="fig.test_dbg">
138 <title>phpinfo showing the DBG section</title>
140 <imageobject role="html">
141 <imagedata align="center" fileref="img/en/xo-002/phpinfo_dbg_section.png" format="PNG"/>
143 <imageobject role="fo">
144 <imagedata align="center" fileref="img/en/xo-002/phpinfo_dbg_section.png" format="PNG" width="12cm"/>
150 In addition you can submit the following URL within your browser: <ulink url="http://localhost/index.php?DBGSESSID=1@localhost:10001"></ulink>. Now, as there is no client running listening to dbg, you should see the following error message
153 <figure id="fig.dbg_error">
154 <title>DBG Error Message</title>
156 <imageobject role="html">
157 <imagedata align="center" fileref="img/en/xo-002/dbg_error.png" format="PNG"/>
159 <imageobject role="fo">
160 <imagedata align="center" fileref="img/en/xo-002/dbg_error.png" format="PNG" width="8cm"/>
167 For setting up a debug configuration and doing real debugging with &phpeclipse;, see <xref linkend="sec.debug_php" />.
176 <sect2 id="sec.install_xdebug">
177 <title>Installing <application>XDEBUG</application></title>
178 <para><indexterm><primary>install</primary><secondary>XDEBUG</secondary></indexterm>
179 The XDebug support is only available through direct checkout of the &phpeclipse; CVS repository.
182 <para> <!-- todo: Get info from wiki -->