PageRenderTime 309ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/html/docs/include/features.php

https://github.com/WouterJ/xdebug.org
PHP | 1414 lines | 1400 code | 12 blank | 2 comment | 3 complexity | e5224c4eab9eb1948c7850a35ef80fcb MD5 | raw file
  1. <?php
  2. $features = array(
  3. 'all_functions' => array(
  4. 'All Functions',
  5. FUNC_ALL,
  6. 'This section describes all available functions available in Xdebug.',
  7. ''
  8. ),
  9. 'all_settings' => array(
  10. 'All Settings',
  11. FUNC_ALL,
  12. 'This section describes all available configuration settings available in Xdebug.',
  13. ''
  14. ),
  15. 'all' => array(
  16. 'The full documentation',
  17. FUNC_ALL,
  18. '',
  19. ''
  20. ),
  21. 'install' => array(
  22. 'Installation',
  23. FUNC_INSTALL,
  24. 'This section describes on how to install Xdebug.',
  25. "
  26. <h2>Precompiled Windows Modules</h2>
  27. <p>
  28. There are a few precompiled modules for Windows, they are all for the non-debug
  29. version of PHP. You can get those at the <a href='/download.php'>download</a>
  30. page. Follow <a href='/wizard.php'>these instructions</a> to get Xdebug
  31. installed.
  32. </p>
  33. <a name='pecl'></a>
  34. <h2>PECL Installation</h2>
  35. <p>
  36. As of Xdebug 0.9.0 you can install Xdebug through PEAR/PECL. This only works
  37. with with PEAR version 0.9.1-dev or higher and some UNIX.
  38. </p>
  39. <p>
  40. Installing with PEAR/PECL is as easy as:
  41. </p>
  42. <pre>
  43. # pecl install xdebug
  44. </pre>
  45. <p>
  46. but you still need to add the correct line to your php.ini: (don't forget to
  47. change the path and filename to the correct one &mdash; but make sure you use
  48. the <b>full path</b>)
  49. </p>
  50. <pre>
  51. zend_extension=\"/usr/local/php/modules/xdebug.so\"
  52. </pre>
  53. <p><b>Note:</b> You should ignore any prompts to add \"extension=xdebug.so\" to
  54. php.ini &mdash; this <b>will</b> cause problems.</p>
  55. <a name='source'></a>
  56. <h2>Installation From Source</h2>
  57. <p>
  58. You can <a href='/download.php#releases'>download</a> the source of the latest <b>stable</b> release [KW:last_release_version].
  59. Alternatively you can obtain Xdebug from GIT:
  60. </p>
  61. <pre>
  62. git clone git://github.com/xdebug/xdebug.git
  63. </pre>
  64. <p>
  65. This will checkout the latest development version which is currently [KW:last_dev_version].
  66. You can also browse the source at <a href='https://github.com/derickr/xdebug'>https://github.com/derickr/xdebug</a>.
  67. </p>
  68. <a name='compile'></a>
  69. <h2>Compiling</h2>
  70. <p>There is a <a href='/wizard.php'>wizard</a> available that provides you
  71. with the correct file to download, and which paths to use.</p>
  72. <p>
  73. You compile Xdebug separately from the rest of PHP. Note, however,
  74. that you need access to the scripts 'phpize' and 'php-config'. If
  75. your system does not have 'phpize' and 'php-config', you will need to
  76. compile and install PHP from a source tarball first, as these script
  77. are by-products of the PHP compilation and installation processes. (Debian users
  78. can install the required tools with
  79. <code>apt-get install php5-dev</code>). It is important that the source version
  80. matches the installed version as there are slight, but important, differences
  81. between PHP versions. Once you have access to 'phpize' and
  82. 'php-config', do the following:
  83. </p>
  84. <p>
  85. <ol>
  86. <li>Unpack the tarball: tar -xzf xdebug-[KW:last_release_version].tgz. Note that you do
  87. not need to unpack the tarball inside the PHP source code tree.
  88. Xdebug is compiled separately, all by itself, as stated above.</li>
  89. <li>cd xdebug-[KW:last_release_version]</li>
  90. <li>Run phpize: phpize (or /path/to/phpize if phpize is not in your path). Make
  91. sure you use the phpize that belongs to the PHP version that you want to use
  92. Xdebug with. See this <a href='/docs/faq#api'>FAQ entry</a> if
  93. you're having some issues with finding which phpize to use.</li>
  94. <li>./configure --enable-xdebug
  95. <li>make</li>
  96. <li>make install</li>
  97. </ol>
  98. <a name='configure-php'></a>
  99. <h2>Configure PHP to Use Xdebug</h2>
  100. <ol>
  101. <li>add the following line to php.ini:
  102. zend_extension=\"/wherever/you/put/it/xdebug.so\" (for non-threaded use of PHP,
  103. for example the CLI, CGI or Apache 1.3 module) or:
  104. zend_extension_ts=\"/wherever/you/put/it/xdebug.so\" (for threaded usage of PHP,
  105. for example the Apache 2 work MPM or the the ISAPI module).
  106. <strong>Note:</strong> In case you compiled PHP yourself and used
  107. --enable-debug you would have to use zend_extension_debug=.
  108. <strong>From PHP 5.3 onwards, you always need to use the zend_extension PHP.ini
  109. setting name, and not zend_extension_ts, nor zend_extension_debug. However,
  110. your compile options (ZTS/normal build; debug/non-debug) still need to match
  111. with what PHP is using.</strong>
  112. </li>
  113. <li>Restart your webserver.</li>
  114. <li>Write a PHP page that calls '<i>phpinfo()</i>' Load it in a browser and
  115. look for the info on the Xdebug module. If you see it next to the Zend logo,
  116. you have been successful! You can also use 'php -m' if you have a command
  117. line version of PHP, it lists all loaded modules. Xdebug should appear
  118. twice there (once under 'PHP Modules' and once under 'Zend Modules').</li>
  119. </ol>
  120. </p>
  121. <a name='compat'></a>
  122. <h2>Compatibility</h2>
  123. <p>
  124. Xdebug does not work together with the Zend Optimizer or any other extension
  125. that deals with PHP's internals (DBG, APD, ioncube etc). This is due to
  126. compatibility problems with those modules.
  127. </p>
  128. <a name='debugclient'></a>
  129. <h2>Debugclient Installation</h2>
  130. <p>
  131. Unpack the Xdebug source tarball and issue the following commands:
  132. </p>
  133. <pre class='example'>
  134. $ cd debugclient
  135. $ ./configure --with-libedit
  136. $ make
  137. # make install
  138. </pre>
  139. <p>
  140. This will install the debugclient binary in /usr/local/bin unless you don't
  141. have libedit installed on your system. You can either install it, or leave
  142. out the '--with-libedit' option to configure. Debian 'unstable' users can
  143. install the library with <code>apt-get install libedit-dev libedit2</code>.
  144. </p>
  145. <p>
  146. If the configure script can not find libedit and you are sure you have (and
  147. it's headers) installed correctly and you get link errors like the
  148. following in your configure.log:
  149. </p>
  150. <pre class='example'>
  151. /usr/lib64/libedit.so: undefined reference to `tgetnum'
  152. /usr/lib64/libedit.so: undefined reference to `tgoto'
  153. /usr/lib64/libedit.so: undefined reference to `tgetflag'
  154. /usr/lib64/libedit.so: undefined reference to `tputs'
  155. /usr/lib64/libedit.so: undefined reference to `tgetent'
  156. /usr/lib64/libedit.so: undefined reference to `tgetstr'
  157. collect2: ld returned 1 exit status
  158. </pre>
  159. <p>
  160. you need to change your configure command to:
  161. </p>
  162. <pre class='example'>
  163. $ LDFLAGS=-lncurses ./configure --with-libedit
  164. </pre>"
  165. ),
  166. 'basic' => array(
  167. 'Basic Features',
  168. FUNC_BASIC,
  169. 'Xdebug\'s basic functions include the display of stack traces on error
  170. conditions, maximum nesting level protection and time tracking.',
  171. ""
  172. ),
  173. 'display' => array(
  174. 'Variable Display Features',
  175. FUNC_VAR_DUMP,
  176. 'Xdebug replaces PHP\'s var_dump() function for displaying variables.
  177. Xdebug\'s version includes different colors for different types and
  178. places limits on the amount of array elements/object properties,
  179. maximum depth and string lengths. There are a few other functions
  180. dealing with variable display as well.',
  181. '
  182. <h2>Effect of settings on var_dump()</h2>
  183. <p>
  184. There is a number of settings that control the output of Xdebug\'s modified
  185. [FUNC:var_dump] function: [CFG:var_display_max_children],
  186. [CFG:var_display_max_data]
  187. and [CFG:var_display_max_depth]. The effect of these three settings is best
  188. shown with an example. The script below is run four time, each time with
  189. different settings. You can use the tabs to see the difference.
  190. </p>
  191. <h3>The script</h3>
  192. <div class="example">
  193. <p>
  194. <code><span style="color: #000000">
  195. <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$pub&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;</span><span style="color: #0000BB">$priv&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;</span><span style="color: #0000BB">$prot&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">42</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">$t&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pub&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">\'a&nbsp;somewhat&nbsp;long&nbsp;string!\'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.zero\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">210</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one.zero\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3.141592564</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one.one\'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">2.7</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'three\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'four\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">range</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">),<br />);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  196. </span>
  197. </code>
  198. </p>
  199. </div>
  200. <h3>The results</h3>
  201. <div id="demosettings" class="yui-navset">
  202. <ul class="yui-nav">
  203. <li class="selected"><a href="#default"><em>default</em></a></li>
  204. <li><a href="#children"><em>children=2</em></a></li>
  205. <li><a href="#data"><em>data=16</em></a></li>
  206. <li><a href="#depth"><em>depth=2</em></a></li>
  207. <li><a href="#multiple"><em>children=3, data=8, depth=1</em></a></li>
  208. </ul>
  209. <div class="yui-content">
  210. <div id="default">
  211. <pre>
  212. <b>array</b>
  213. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  214. \'two\' <font color=\'#888a85\'>=&gt;</font>
  215. <b>array</b>
  216. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  217. <b>array</b>
  218. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  219. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  220. <b>array</b>
  221. ...
  222. \'three\' <font color=\'#888a85\'>=&gt;</font>
  223. <b>object</b>(<i>test</i>)[<i>1</i>]
  224. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  225. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  226. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  227. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  228. \'four\' <font color=\'#888a85\'>=&gt;</font>
  229. <b>array</b>
  230. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  231. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  232. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  233. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  234. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  235. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  236. </pre>
  237. </div>
  238. <div id="children">
  239. <pre>
  240. <b>array</b>
  241. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  242. \'two\' <font color=\'#888a85\'>=&gt;</font>
  243. <b>array</b>
  244. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  245. <b>array</b>
  246. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  247. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  248. <b>array</b>
  249. ...
  250. <i>more elements...</i>
  251. </pre>
  252. </div>
  253. <div id="data">
  254. <pre>
  255. <b>array</b>
  256. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long \'...</font> <i>(length=23)</i>
  257. \'two\' <font color=\'#888a85\'>=&gt;</font>
  258. <b>array</b>
  259. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  260. <b>array</b>
  261. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  262. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  263. <b>array</b>
  264. ...
  265. \'three\' <font color=\'#888a85\'>=&gt;</font>
  266. <b>object</b>(<i>test</i>)[<i>1</i>]
  267. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  268. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  269. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  270. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  271. \'four\' <font color=\'#888a85\'>=&gt;</font>
  272. <b>array</b>
  273. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  274. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  275. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  276. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  277. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  278. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  279. </pre>
  280. </div>
  281. <div id="depth">
  282. <pre>
  283. <b>array</b>
  284. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  285. \'two\' <font color=\'#888a85\'>=&gt;</font>
  286. <b>array</b>
  287. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  288. <b>array</b>
  289. ...
  290. \'three\' <font color=\'#888a85\'>=&gt;</font>
  291. <b>object</b>(<i>test</i>)[<i>1</i>]
  292. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  293. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  294. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  295. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  296. \'four\' <font color=\'#888a85\'>=&gt;</font>
  297. <b>array</b>
  298. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  299. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  300. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  301. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  302. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  303. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  304. </pre>
  305. </div>
  306. <div id="multiple">
  307. <pre>
  308. <b>array</b>
  309. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewh\'...</font> <i>(length=23)</i>
  310. \'two\' <font color=\'#888a85\'>=&gt;</font>
  311. <b>array</b>
  312. ...
  313. \'three\' <font color=\'#888a85\'>=&gt;</font>
  314. <b>object</b>(<i>test</i>)[<i>1</i>]
  315. ...
  316. <i>more elements...</i>
  317. </pre>
  318. </div>
  319. </div>
  320. </div>',
  321. array( 'tabfields' => array( 'demosettings' ) )
  322. ),
  323. 'stack_trace' => array(
  324. 'Stack Traces',
  325. FUNC_STACK_TRACE,
  326. 'When Xdebug is activated it will show a stack trace whenever PHP
  327. decides to show a notice, warning, error etc. The information that
  328. stack traces display, and the way how they are presented, can be
  329. configured to suit your needs.',
  330. '
  331. <p>
  332. The stack traces that Xdebug shows on error situations (if <a
  333. href="http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a>
  334. is set to On in php.ini) are quite conservative in the amount of
  335. information that they show. This is because large amounts of information can
  336. slow down both the execution of the scripts and the rendering of the stack
  337. traces themselves in the browser. However, it is possible to make the stack
  338. traces show more detailed information with different settings.
  339. </p>
  340. <h2>Variables in Stack Traces</h2>
  341. <p>
  342. By default Xdebug will now show variable information in the stack traces that
  343. it produces. Variable information can take quite a bit of resources, both while
  344. collecting or displaying. However, in many cases it is useful that variable
  345. information is displayed, and that is why Xdebug has the setting
  346. [CFG:collect_params]. The script below, in combination with what the output
  347. will look like with different values of this setting is shown in the example
  348. below.
  349. </p>
  350. <h3>The script</h3>
  351. <div class="example">
  352. <p>
  353. <code><span style="color: #000000">
  354. <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #DD0000">\'foo\'</span><span style="color: #007700">];&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">500000</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">xdebug_break</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">set_time_limit</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">stdClass</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">42&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">\'foo\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">912124</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;new&nbsp;</span><span style="color: #0000BB">stdClass</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">\'/etc/passwd\'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">\'r\'&nbsp;</span><span style="color: #007700">)<br />);<br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  355. </span>
  356. </code>
  357. </p>
  358. </div>
  359. <h3>The results</h3>
  360. <p>
  361. Different values for the [CFG:collect_params] setting give different output,
  362. which you can see below:
  363. </p>
  364. <div id="collectparams" class="yui-navset">
  365. <ul class="yui-nav">
  366. <li class="selected"><a href="#default"><em>default</em></a></li>
  367. <li><a href="#collect-params-1"><em>1</em></a></li>
  368. <li><a href="#collect-params-2"><em>2</em></a></li>
  369. <li><a href="#collect-params-3"><em>3</em></a></li>
  370. <li><a href="#collect-params-4"><em>4</em></a></li>
  371. </ul>
  372. <div class="yui-content">
  373. <div id="default">
  374. <br />
  375. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  376. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>34</i></th></tr>
  377. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  378. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  379. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  380. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62764</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  381. </table></font>
  382. </div>
  383. <div id="collect-params-1">
  384. <pre>
  385. ini_set(\'xdebug.collect_params\', \'1\');
  386. </pre>
  387. <br />
  388. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  389. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  390. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  391. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  392. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  393. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62380</td><td bgcolor=\'#eeeeec\'>foo( <span><font color=\'#ce5c00\'>array(5)</font></span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  394. </table></font>
  395. </div>
  396. <div id="collect-params-2">
  397. <pre>
  398. ini_set(\'xdebug.collect_params\', \'2\');
  399. </pre>
  400. <br />
  401. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  402. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  403. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  404. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  405. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  406. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62812</td><td bgcolor=\'#eeeeec\'>foo( <span title=\'array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))\'><font color=\'#ce5c00\'>array(5)</font></span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  407. </table></font>
  408. </div>
  409. <div id="collect-params-3">
  410. <pre>
  411. ini_set(\'xdebug.collect_params\', \'3\');
  412. </pre>
  413. <br />
  414. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  415. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  416. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  417. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  418. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  419. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62812</td><td bgcolor=\'#eeeeec\'>foo( <span>array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))</span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  420. </table></font>
  421. </div>
  422. <div id="collect-params-4">
  423. <pre>
  424. ini_set(\'xdebug.collect_params\', \'4\');
  425. </pre>
  426. <br />
  427. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  428. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  429. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  430. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  431. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  432. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62380</td><td bgcolor=\'#eeeeec\'>foo( <span>$a = </span><span>array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))</span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  433. </table></font>
  434. </div>
  435. </div>
  436. </div>
  437. <h2>Additional Information</h2>
  438. <p>
  439. On top of showing the values of variables that were passed to each function
  440. Xdebug can also optionally show information about selected superglobals by using
  441. the [CFG:dump_globals] and [CFG:dump.*] settings. The settings [CFG:dump_once]
  442. and [CFG:dump_undefined] slightly modify when and which information is shown
  443. from the available superglobals. With the [CFG:show_local_vars] setting you can
  444. instruct Xdebug to show all variables available in the top-most stack level for
  445. a user defined function as well. The examples below show this (the script is
  446. used from the example above).
  447. </p>
  448. <div id="othersettings" class="yui-navset">
  449. <ul class="yui-nav">
  450. <li class="selected"><a href="#add-default"><em>default</em></a></li>
  451. <li><a href="#add-superglobals"><em>dump_superglobals=1</em></a></li>
  452. <li><a href="#add-local-vars"><em>show_local_vars=1</em></a></li>
  453. </ul>
  454. <div class="yui-content">
  455. <div id="add-default">
  456. <br />
  457. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  458. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>34</i></th></tr>
  459. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  460. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  461. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  462. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62764</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  463. </table></font>
  464. </div>
  465. <div id="add-superglobals">
  466. <pre>
  467. ini_set(\'xdebug.collect_vars\', \'on\');
  468. ini_set(\'xdebug.collect_params\', \'4\');
  469. ini_set(\'xdebug.dump_globals\', \'on\');
  470. ini_set(\'xdebug.dump.SERVER\', \'REQUEST_URI\');
  471. </pre>
  472. <br />
  473. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  474. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>33</i></th></tr>
  475. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  476. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  477. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  478. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62436</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  479. <tr><th colspan=\'5\' align=\'left\' bgcolor=\'#e9b96e\'>Dump <i>$_SERVER</i></th></tr>
  480. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$_SERVER[\'REQUEST_URI\']&nbsp;=</pre></td><td colspan=\'3\' bgcolor=\'#eeeeec\'><pre><small>string</small> <font color=\'#cc0000\'>\'/test/xdebug/docs/stack.php?level=5\'</font> <i>(length=35)</i>
  481. </pre></td></tr>
  482. </table></font>
  483. </div>
  484. <div id="add-local-vars">
  485. <pre>
  486. ini_set(\'xdebug.collect_vars\', \'on\');
  487. ini_set(\'xdebug.collect_params\', \'4\');
  488. ini_set(\'xdebug.dump_globals\', \'on\');
  489. ini_set(\'xdebug.dump.SERVER\', \'REQUEST_URI\');
  490. ini_set(\'xdebug.show_local_vars\', \'on\');
  491. </pre>
  492. <br />
  493. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  494. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  495. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  496. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  497. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  498. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0005</td><td bgcolor=\'#eeeeec\' align=\'right\'>62588</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  499. <tr><th colspan=\'5\' align=\'left\' bgcolor=\'#e9b96e\'>Dump <i>$_SERVER</i></th></tr>
  500. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$_SERVER[\'REQUEST_URI\']&nbsp;=</pre></td><td colspan=\'3\' bgcolor=\'#eeeeec\'><pre><small>string</small> <font color=\'#cc0000\'>\'/test/xdebug/docs/stack.php?level=6\'</font> <i>(length=35)</i>
  501. </pre></td></tr>
  502. <tr><th align=\'left\' colspan=\'5\' bgcolor=\'#e9b96e\'>Variables in local scope (#2)</th></tr>
  503. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$a&nbsp;=</pre></td><td colspan=\'4\' bgcolor=\'#eeeeec\'><pre>
  504. <b>array</b>
  505. 42 <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>false</font>
  506. \'foo\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>912124</font>
  507. 43 <font color=\'#888a85\'>=&gt;</font>
  508. <b>object</b>(<i>stdClass</i>)[<i>1</i>]
  509. <i>public</i> \'bar\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>100</font>
  510. 44 <font color=\'#888a85\'>=&gt;</font>
  511. <b>object</b>(<i>stdClass</i>)[<i>2</i>]
  512. 45 <font color=\'#888a85\'>=&gt;</font> <b>resource</b>(<i>2</i><font color=\'#2e3436\'>,</font> <i>stream</i>)
  513. </pre></td></tr>
  514. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$i&nbsp;=</pre></td><td colspan=\'4\' bgcolor=\'#eeeeec\'><pre><small>int</small> <font color=\'#4e9a06\'>275447</font>
  515. </pre></td></tr>
  516. </table></font>
  517. </div>
  518. </div>
  519. </div>',
  520. array( 'tabfields' => array( 'collectparams', 'othersettings' ) )
  521. ),
  522. 'execution_trace' => array(
  523. 'Function Traces',
  524. FUNC_FUNCTION_TRACE,
  525. 'Xdebug allows you to log all function calls, including parameters and
  526. return values to a file in different formats.',
  527. '
  528. <p>
  529. Those so-called "function traces" can be a help for when you are new to an
  530. application or when you are trying to figure out what exactly is going on when
  531. your application is running. The function traces can optionally also show the
  532. values of variables passed to the functions and methods, and also return
  533. values. In the default traces those two elements are not available.
  534. </p>
  535. <h2>Output Formats</h2>
  536. <p>
  537. There are three output formats. One is meant as a human readable trace, another
  538. one is more suited for computer programs as it is easier to parse, and the last
  539. one uses HTML for formatting the trace. You can switch between the two
  540. different formats with the [CFG:trace_format] setting. There are a few settings
  541. that control which information is written to the trace files. There are
  542. settings for including variables ([CFG:collect_params]) and for including
  543. return values ([CFG:collect_return]) for example. The example below shows what
  544. effect the different settings have for the human readable function traces.
  545. </p>
  546. <h3>The Script</h3>
  547. <div class="example">
  548. <p>
  549. <code><span style="color: #000000">
  550. <span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Xdebug"</span><span style="color: #007700">;<br />function&nbsp;</span><span style="color: #0000BB">ret_ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">);<br />}<br /><br />foreach&nbsp;(&nbsp;</span><span style="color: #0000BB">str_split</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$char&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$char</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">":&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">ret_ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$char&nbsp;</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  551. </span>
  552. </code>
  553. </p>
  554. </div>
  555. <h3>The Results</h3>
  556. <p>
  557. Below are the results with different settings of the [CFG:collect_params]
  558. setting. As this is not a web environment the value of 2 does not have any
  559. meaning as tool tips don\'t work in text files.
  560. </p>
  561. <div id="collectparams" class="yui-navset">
  562. <ul class="yui-nav">
  563. <li class="selected"><a href="#default1"><em>default</em></a></li>
  564. <li><a href="#collect-params-1"><em>collect_params=1</em></a></li>
  565. <li><a href="#collect-params-3"><em>collect_params=3</em></a></li>
  566. <li><a href="#collect-params-4"><em>collect_params=4</em></a></li>
  567. </ul>
  568. <div class="yui-content">
  569. <div id="default1">
  570. <pre class="shell">
  571. TRACE START [2007-05-06 14:37:06]
  572. 0.0003 114112 -> {main}() ../trace.php:0
  573. 0.0004 114272 -> str_split() ../trace.php:8
  574. 0.0153 117424 -> ret_ord() ../trace.php:10
  575. 0.0165 117584 -> ord() ../trace.php:5
  576. 0.0166 117584 -> ret_ord() ../trace.php:10
  577. 0.0167 117584 -> ord() ../trace.php:5
  578. 0.0168 117584 -> ret_ord() ../trace.php:10
  579. 0.0168 117584 -> ord() ../trace.php:5
  580. 0.0170 117584 -> ret_ord() ../trace.php:10
  581. 0.0170 117584 -> ord() ../trace.php:5
  582. 0.0172 117584 -> ret_ord() ../trace.php:10
  583. 0.0172 117584 -> ord() ../trace.php:5
  584. 0.0173 117584 -> ret_ord() ../trace.php:10
  585. 0.0174 117584 -> ord() ../trace.php:5
  586. 0.0177 41152
  587. TRACE END [2007-05-06 14:37:07]
  588. </pre>
  589. </div>
  590. <div id="collect-params-1">
  591. <pre class="shell">
  592. TRACE START [2007-05-06 14:37:11]
  593. 0.0003 114112 -> {main}() ../trace.php:0
  594. 0.0004 114272 -> str_split(string(6)) ../trace.php:8
  595. 0.0007 117424 -> ret_ord(string(1)) ../trace.php:10
  596. 0.0007 117584 -> ord(string(1)) ../trace.php:5
  597. 0.0009 117584 -> ret_ord(string(1)) ../trace.php:10
  598. 0.0009 117584 -> ord(string(1)) ../trace.php:5
  599. 0.0010 117584 -> ret_ord(string(1)) ../trace.php:10
  600. 0.0011 117584 -> ord(string(1)) ../trace.php:5
  601. 0.0012 117584 -> ret_ord(string(1)) ../trace.php:10
  602. 0.0013 117584 -> ord(string(1)) ../trace.php:5
  603. 0.0014 117584 -> ret_ord(string(1)) ../trace.php:10
  604. 0.0014 117584 -> ord(string(1)) ../trace.php:5
  605. 0.0016 117584 -> ret_ord(string(1)) ../trace.php:10
  606. 0.0016 117584 -> ord(string(1)) ../trace.php:5
  607. 0.0019 41152
  608. TRACE END [2007-05-06 14:37:11]
  609. </pre>
  610. </div>
  611. <div id="collect-params-3">
  612. <pre class="shell">
  613. TRACE START [2007-05-06 14:37:13]
  614. 0.0003 114112 -> {main}() ../trace.php:0
  615. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  616. 0.0007 117424 -> ret_ord(\'X\') ../trace.php:10
  617. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  618. 0.0009 117584 -> ret_ord(\'d\') ../trace.php:10
  619. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  620. 0.0010 117584 -> ret_ord(\'e\') ../trace.php:10
  621. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  622. 0.0012 117584 -> ret_ord(\'b\') ../trace.php:10
  623. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  624. 0.0014 117584 -> ret_ord(\'u\') ../trace.php:10
  625. 0.0014 117584 -> ord(\'u\') ../trace.php:5
  626. 0.0016 117584 -> ret_ord(\'g\') ../trace.php:10
  627. 0.0016 117584 -> ord(\'g\') ../trace.php:5
  628. 0.0019 41152
  629. TRACE END [2007-05-06 14:37:13]
  630. </pre>
  631. </div>
  632. <div id="collect-params-4">
  633. <pre class="shell">
  634. TRACE START [2007-05-06 14:37:16]
  635. 0.0003 114112 -> {main}() ../trace.php:0
  636. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  637. 0.0007 117424 -> ret_ord($c = \'X\') ../trace.php:10
  638. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  639. 0.0009 117584 -> ret_ord($c = \'d\') ../trace.php:10
  640. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  641. 0.0010 117584 -> ret_ord($c = \'e\') ../trace.php:10
  642. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  643. 0.0012 117584 -> ret_ord($c = \'b\') ../trace.php:10
  644. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  645. 0.0014 117584 -> ret_ord($c = \'u\') ../trace.php:10
  646. 0.0014 117584 -> ord(\'u\') ../trace.php:5
  647. 0.0016 117584 -> ret_ord($c = \'g\') ../trace.php:10
  648. 0.0016 117584 -> ord(\'g\') ../trace.php:5
  649. 0.0019 41152
  650. TRACE END [2007-05-06 14:37:16]
  651. </pre>
  652. </div>
  653. </div>
  654. </div>
  655. <p>
  656. Besides the [CFG:collect_params] settings there is another number of settings
  657. that affect the output of trace files. The first tab "default" shows the same
  658. as the default as above. The second tab "show_mem_delta=1" also shows the
  659. memory usage difference between two different lines in the output file.
  660. </p>
  661. <p>
  662. On the "collect_return=1" tab the return values of all the function calls are
  663. also visible. This you turn on with the [CFG:collect_return] setting.
  664. </p>
  665. <p>
  666. The tab called "collect_assignments=1" shows variable assigments, which can be
  667. turned on with the [CFG:collect_assignments] setting.
  668. </p>
  669. <p>
  670. The last tab shows a different output format that is much easier to parse, but
  671. harder to read. The [CFG:trace_format] setting is therefore mostly useful if
  672. there is an additional tool to interpret the trace files.
  673. </p>
  674. <div id="othersettings" class="yui-navset">
  675. <ul class="yui-nav">
  676. <li class="selected"><a href="#default2"><em>default</em></a></li>
  677. <li><a href="#mem-delta"><em>show_mem_delta=1</em></a></li>
  678. <li><a href="#collect-return"><em>collect_return=1</em></a></li>
  679. <li><a href="#trace-format"><em>trace_format=1</em></a></li>
  680. </ul>
  681. <div class="yui-content">
  682. <div id="default2">
  683. <pre class="shell">
  684. TRACE START [2007-05-06 14:37:06]
  685. 0.0003 114112 -> {main}() ../trace.php:0
  686. 0.0004 114272 -> str_split() ../trace.php:8
  687. 0.0153 117424 -> ret_ord() ../trace.php:10
  688. 0.0165 117584 -> ord() ../trace.php:5
  689. 0.0166 117584 -> ret_ord() ../trace.php:10
  690. 0.0167 117584 -> ord() ../trace.php:5
  691. 0.0168 117584 -> ret_ord() ../trace.php:10
  692. 0.0168 117584 -> ord() ../trace.php:5
  693. 0.0170 117584 -> ret_ord() ../trace.php:10
  694. 0.0170 117584 -> ord() ../trace.php:5
  695. 0.0172 117584 -> ret_ord() ../trace.php:10
  696. 0.0172 117584 -> ord() ../trace.php:5
  697. 0.0173 117584 -> ret_ord() ../trace.php:10
  698. 0.0174 117584 -> ord() ../trace.php:5
  699. 0.0177 41152
  700. TRACE END [2007-05-06 14:37:07]
  701. </pre>
  702. </div>
  703. <div id="mem-delta">
  704. <pre class="shell">
  705. TRACE START [2007-05-06 14:37:26]
  706. 0.0003 114112 +114112 -> {main}() ../trace.php:0
  707. 0.0004 114272 +160 -> str_split(\'Xdebug\') ../trace.php:8
  708. 0.0007 117424 +3152 -> ret_ord($c = \'X\') ../trace.php:10
  709. 0.0007 117584 +160 -> ord(\'X\') ../trace.php:5
  710. 0.0009 117584 +0 -> ret_ord($c = \'d\') ../trace.php:10
  711. 0.0009 117584 +0 -> ord(\'d\') ../trace.php:5
  712. 0.0011 117584 +0 -> ret_ord($c = \'e\') ../trace.php:10
  713. 0.0011 117584 +0 -> ord(\'e\') ../trace.php:5
  714. 0.0013 117584 +0 -> ret_ord($c = \'b\') ../trace.php:10
  715. 0.0013 117584 +0 -> ord(\'b\') ../trace.php:5
  716. 0.0014 117584 +0 -> ret_ord($c = \'u\') ../trace.php:10
  717. 0.0015 117584 +0 -> ord(\'u\') ../trace.php:5
  718. 0.0016 117584 +0 -> ret_ord($c = \'g\') ../trace.php:10
  719. 0.0017 117584 +0 -> ord(\'g\') ../trace.php:5
  720. 0.0019 41152
  721. TRACE END [2007-05-06 14:37:26]
  722. </pre>
  723. </div>
  724. <div id="collect-return">
  725. <pre class="shell">
  726. TRACE START [2007-05-06 14:37:35]
  727. 0.0003 114112 -> {main}() ../trace.php:0
  728. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  729. >=> array (0 => \'X\', 1 => \'d\', 2 => \'e\', 3 => \'b\', 4 => \'u\', 5 => \'g\')
  730. 0.0007 117424 -> ret_ord($c = \'X\') ../trace.php:10
  731. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  732. >=> 88
  733. >=> 88
  734. 0.0009 117584 -> ret_ord($c = \'d\') ../trace.php:10
  735. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  736. >=> 100
  737. >=> 100
  738. 0.0011 117584 -> ret_ord($c = \'e\') ../trace.php:10
  739. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  740. >=> 101
  741. >=> 101
  742. 0.0013 117584 -> ret_ord($c = \'b\') ../trace.php:10
  743. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  744. >=> 98
  745. >=> 98
  746. 0.0015 117584 -> ret_ord($c = \'u\') ../trace.php:10
  747. 0.0016 117584 -> ord(\'u\') ../trace.php:5
  748. >=> 117
  749. >=> 117
  750. 0.0017 117584 -> ret_ord($c = \'g\') ../trace.php:10
  751. 0.0018 117584 -> ord(\'g\') ../trace.php:5
  752. >=> 103
  753. >=> 103
  754. >=> 1
  755. 0.0021 41152
  756. TRACE END [2007-05-06 14:37:35]
  757. </pre>
  758. </div>
  759. <div id="trace-format">
  760. <pre class="shell">
  761. Version: 2.0.0RC4-dev
  762. TRACE START [2007-05-06 18:29:01]
  763. 1 0 0 0.010870 114112 {main} 1 ../trace.php 0
  764. 2 1 0 0.032009 114272 str_split 0 ../trace.php 8
  765. 2 1 1 0.032073 116632
  766. 2 2 0 0.033505 117424 ret_ord 1 ../trace.php 10
  767. 3 3 0 0.033531 117584 ord 0 ../trace.php 5
  768. 3 3 1 0.033551 117584
  769. 2 2 1 0.033567 117584
  770. 2 4 0 0.033718 117584 ret_ord 1 ../trace.php 10
  771. 3 5 0 0.033740 117584 ord 0 ../trace.php 5
  772. 3 5 1 0.033758 117584
  773. 2 4 1 0.033770 117584
  774. 2 6 0 0.033914 117584 ret_ord 1 ../trace.php 10
  775. 3 7 0 0.033936 117584 ord 0 ../trace.php 5
  776. 3 7 1 0.033953 117584
  777. 2 6 1 0.033965 117584
  778. 2 8 0 0.034108 117584 ret_ord 1 ../trace.php 10
  779. 3 9 0 0.034130 117584 ord 0 ../trace.php 5
  780. 3 9 1 0.034147 117584
  781. 2 8 1 0.034160 117584
  782. 2 10 0 0.034302 117584 ret_ord 1 ../trace.php 10
  783. 3 11 0 0.034325 117584 ord 0 ../trace.php 5
  784. 3 11 1 0.034342 117584
  785. 2 10 1 0.034354 117584
  786. 2 12 0 0.034497 117584 ret_ord 1 ../trace.php 10
  787. 3 13 0 0.034519 117584 ord 0 ../trace.php 5
  788. 3 13 1 0.034536 117584
  789. 2 12 1 0.034549 117584
  790. 1 0 1 0.034636 117584
  791. TRACE END [2007-05-06 18:29:01]
  792. </pre>
  793. </div>
  794. </div>
  795. </div>
  796. <a name="vim"></a>
  797. <h2>VIM syntax file</h2>
  798. <p>
  799. Xdebug ships with a VIM syntax file that syntax highlights the trace files:
  800. xt.vim. In order to make VIM recognise this new format you need to perform the
  801. following steps:
  802. </p>
  803. <ol>
  804. <li>Copy the <i>xt.vim</i> file to <i>~/.vim/syntax</i></li>
  805. <li>Edit, or create, <i>~/.vim/filetype.vim</i> and add the following lines:
  806. <pre>
  807. augroup filetypedetect
  808. au BufNewFile,BufRead *.xt setf xt
  809. augroup END
  810. </pre>
  811. </li>
  812. </ol>
  813. <p>
  814. With those settings made an opened trace file looks like:
  815. </p>
  816. <pre style="background-color: #000000; color: #fff;">
  817. <font color="#ffff00"><b>TRACE START</b></font> <font color="#ffff00"><b>[2007-05-15 20:06:02]</b></font>
  818. 0.0003 115208 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#ff6060"><b>{main}()</b></font> ../trace.php<font color="#ff40ff"><b>:0</b></font>
  819. 0.0004 115368 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>str_split(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:8</b></font>
  820. 0.0006 118520 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  821. 0.0007 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  822. 0.0008 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  823. 0.0009 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  824. 0.0010 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  825. 0.0010 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  826. 0.0012 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  827. 0.0012 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  828. 0.0014 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  829. 0.0014 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  830. 0.0016 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ret_ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:10</b></font>
  831. 0.0016 118680 <font color="#ff40ff"><b>-&gt;</b></font> <font color="#00ffff"><b>ord(</b></font><font color="#00ffff"><b>) </b></font>../trace.php<font color="#ff40ff"><b>:5</b></font>
  832. 0.0019 54880
  833. <font color="#ffff00"><b>TRACE END</b></font> <font color="#ffff00"><b>[2007-05-15 20:06:02]</b></font>
  834. </pre>
  835. <p>
  836. Folding also sorta works so you can use <i>zc</i> and <i>zo</i> to fold away
  837. parts of the trace files.
  838. </p>
  839. ',
  840. array( 'tabfields' => array( 'collectparams', 'othersettings' ) )
  841. ),
  842. 'code_coverage' => array(
  843. 'Code Coverage Analysis',
  844. FUNC_CODE_COVERAGE,
  845. 'Code coverage tells you which lines of script (or set of scripts) have
  846. been executed during a request. With this information you can for
  847. example find out how good your unit tests are.',
  848. ""
  849. ),
  850. 'profiler' => array(
  851. 'Profiling PHP Scripts',
  852. FUNC_PROFILER,
  853. 'Xdebug\'s built-in profiler allows you to find bottlenecks in your
  854. script and visualize those with an external tool such as KCacheGrind or
  855. WinCacheGrind.',
  856. '
  857. <a name="introduction"></a>
  858. <h2>Introduction</h2>
  859. <p>Xdebug\'s Profiler is a powerful tool that gives you the ability to analyze
  860. your PHP code and determine bottlenecks or generally see which parts of your
  861. code are slow and could use a speed boost. The profiler in Xdebug 2 outputs
  862. profiling information in the form of a cachegrind compatible file. This allows
  863. you to use the excellent <a href="http://kcachegrind.sf.net">KCacheGrind</a>
  864. tool (Linux/Windows, KDE) to analyse your profiling data. If you are on Linux
  865. you can install KCacheGrind with your favourite package manager; if you are on
  866. Windows you can get precompiled binaries of KCacheGrind at
  867. <a href="http://sourceforge.net/projects/precompiledbin/">SourceForge</a>.</p>
  868. <p>Users of Windows can also use
  869. <a href="http://sourceforge.net/projects/wincachegrind">WinCacheGrind</a>, the
  870. functionality is different from KCacheGrind so the section that documents the
  871. use of KCacheGrind on this page doesn\'t apply to this program. There is also
  872. an alternative profile information presentation tool called
  873. <a href="http://code.google.com/p/xdebugtoolkit/">xdebugtoolkit</a>, a web
  874. based front-end called <a
  875. href="http://code.google.com/p/webgrind/">Webgrind</a> and a Java based tool
  876. called <a
  877. href="http://sourceforge.net/projects/xcallgraph/">XCallGraph</a>.</p>
  878. <p>In case you can not use KDE (or do not want to use KDE) the kcachegrind
  879. package also comes with a perl script "ct_annotate" which produces ASCII output
  880. from the profiler trace files.</p>
  881. <a name="starting"></a>
  882. <h2>Starting The Profiler</h2>
  883. <p>Profiling is enabled by setting the
  884. [CFG:profiler_enable] setting
  885. to 1 in php.ini. This instructs Xdebug to start writing profiling information
  886. into the dump directory configured with the
  887. [CFG:profiler_output_dir]
  888. directive. The name of the generated file always starts with
  889. "<span class="filename">cachegrind.out.</span>" and ends with either the PID
  890. (process ID) of the PHP (or Apache) process or the crc32 hash of the
  891. directory containing the initially debugged script. Make sure you have enough
  892. space in your [CFG:profiler_output_dir] as the amount of information generated by the profiler can be
  893. enormous for complex scripts, for example up to 500MB for a complex application
  894. like <a href="http://ez.no">eZ Publish</a>.</p>
  895. <p>You can also selectively enable the profiler with the
  896. [CFG:profiler_enable_trigger] setting set to 1. If it is set to 1, then you can
  897. enable the profiler by using a GET/POST or COOKIE variable of the name
  898. XDEBUG_PROFILE. The FireFox 2 extension that can be used to enable the debugger
  899. (see <a href="/docs/remote#firefox-ext">HTTP Debug Sessions</a>) can also be
  900. used with this setting. In order for the trigger to work properly,
  901. [CFG:profiler_enable] needs to be set to 0.</p>
  902. <a name="misc"></a>
  903. <h2>Analysing Profiles</h2>
  904. <p>After a profile information file has been generated you can open it with
  905. <a href="http://kcachegrind.sf.net">KCacheGrind</a>:</p>
  906. <p><img src="/images/docs/kc-open.png"/></p>
  907. <p>Once the file is opened you have plenty of information available in the
  908. different panes of <a href="http://kcachegrind.sf.net">KCacheGrind</a>. On the left side you find the "Flat Profile"
  909. pane showing all functions in your script sorted by time spend in this function,
  910. and all its children.
  911. <img class="l" src="/images/docs/kc-profile.png" align="left"/>
  912. The second column "Self" shows the time spend in this function (without its
  913. children), the third column "Called" shows how often a specific function was
  914. called and the last column "Function" shows the name of the function. Xdebug
  915. changes internal PHP function names by prefixing the function name with
  916. "php::" and include files are handled in a special way too. Calls to include
  917. (and include_one, require and require_once) are followed by "::" and the
  918. filename of the included file. In the screenshot on the left you can see this
  919. for "include::/home/httpd/ez_34/v..." and an example of an internal PHP
  920. function is "php::mysql_query".
  921. <img class="r" src="/images/docs/kc-percentage.png" align="right"/>
  922. The numbers in the first two columns can be
  923. either percentages of the full running time of the script (like in the
  924. example) or absolute time (1 unit is 1/1.000.000th of a second). You can
  925. switch between the two modes with the button you see on the right.</p>
  926. <p>The pane on the right contains an upper and lower pane. The upper one
  927. shows information about which functions called the current selected function
  928. ("eztemplatedesignresource-&gt;executecompiledtemplate in the screenshot).
  929. <img class="r" src="/images/docs/kc-right-call.png" align="right"/>
  930. The lower pane shows information about the functions that the current selected
  931. function called.</p>
  932. <p>The "Cost" column in the upper pane shows the time spend in the current
  933. selected function while being called from the function in the list. The numbers
  934. in the Cost column added up will always be 100%. The "Cost" column in the lower
  935. pane shows the time spend while calling the function from the list. While adding
  936. the numbers in this list up, you will most likely never reach 100% as the
  937. selected function itself will also takes time to execute.</p>
  938. <p>The "All Callers" and "All Calls" tabs show not only the direct call from
  939. <img class="l" src="/images/docs/kc-right-callers.png" align="left"/>
  940. which the function was called respectively all directly made
  941. function calls but also function calls made more levels up and down.
  942. The upper pane in the screenshot on the left shows all functions calling the
  943. current selected one, both directly and indirectly with other functions
  944. inbetween them on the stack. The "Distance" column shows how many function
  945. calls are between the listed and the current selected one (-1). If there are
  946. different distances between two functions, it is shown as a range (for example
  947. "5-24". The number in parentheses is the median distance. The lower pane is
  948. similar except that it shows information on functions called from the current
  949. selected one, again either direct or indirect.</p>
  950. '
  951. ),
  952. 'remote' => array(
  953. 'Remote Debugging',
  954. FUNC_REMOTE,
  955. 'Xdebug provides an interface for debugger clients that interact with
  956. running PHP scripts. This section explains how to set-up PHP and Xdebug
  957. to allow this, and introduces a few clients.',
  958. '
  959. <a name="introduction"></a>
  960. <h2>Introduction</h2>
  961. <p>Xdebug\'s (remote) debugger allows you to examine data structure,
  962. interactively walk through your and debug your code. There are two different
  963. protocols to communicate with the debugger: the old GDB-like command protocol
  964. (GDB) which is implemented in Xdebug 1.3 and 2; and the <a
  965. href="/docs-dbgp.php">DBGp</a> protocol which is implemented in Xdebug 2.
  966. </p>
  967. <a name="clients"></a>
  968. <h2>Clients</h2>
  969. <p>
  970. Xdebug 2 is bundled with a <b>simple command line client</b> for the
  971. <a href="/docs-dbgp.php">DBGp</a> protocol.
  972. There are a few other client implementations (both free and commercial) as
  973. well. I am not the author of any of those, so please refer to the original
  974. authors for <b>support</b>:
  975. <ul>
  976. <li><b><a href="http://devphp.sf.net/">Dev-PHP</a></b> (IDE: Windows)</li>
  977. <li><b>Eclipse <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408">plugin</a></b>, which has been submitted as an enhancement for the <a href="http://www.eclipse.org/php/">PDT</a> (IDE).</li>
  978. <li><b>Emacs <a href="http://code.google.com/p/geben-on-emacs/">plugin</a></b> (Editor Plugin).</li>
  979. <li>ActiveState\'s <b><a href="http://activestate.com/products/komodo_ide/?src=AScom&type=bn&X=HP&campaign=KMD">Komodo</a></b> (IDE: Windows, Linux, Mac; Commercial).</li>
  980. <li><b><a href="http://www.bluestatic.org/software/macgdbp/index.php">MacGDBP</a></b> - Standalone Mac client.</li>
  981. <li><b><a href="http://php.netbeans.org">NetBeans</a></b> (IDE: Windows, Linux, Mac OS X and Solaris.</li>
  982. <li><b><a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a></b> <a href="http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=236520">plugin</a> (Editor: Windows).</li>
  983. <li>WaterProof\'s <b><a href="http://www.waterproof.fr/products/PHPEdit/">PHPEdit</a></b> (IDE, from version 2.10: Windows; Commercial).</li>
  984. <li>Anchor System\'s <b><a href="http://www.anchorsystems.co.jp/anchor/ashp/peggy/pegindex.html">Peggy</a></b> (IDE: Windows, Japanese; Commercial).</li>
  985. <li>MP Software\'s <b><a href="http://www.mpsoftware.dk/products.php">phpDesigner</a></b> (IDE: Windows, Commercial).</li>
  986. <li><b><a href="http://www.phpeclipse.com/">PHPEclipse</a></b> (Editor Plugin).</li>
  987. <li>JetBrain\'s<b><a href="http://www.jetbrains.com/phpstorm/">PhpStorm</a></b> (IDE; Commercial).</li>
  988. <li><b><a href="http://protoeditor.sourceforge.net/">Protoeditor</a></b> (Editor: Linux).</li>
  989. <li><b><a href="http://tswebeditor.net.tc/">tsWebeditor</a></b> (Editor: Windows).</li>
  990. <li>Xored\'s <b><a href="http://www.xored.com/trustudio">TrueStudio IDE</a></b> (IDE; Commercial).</li>
  991. <li><b>VIM <a href="http://www.vim.org/scripts/script.php?script_id=1929">plugin</a></b> (<a href="http://tech.blog.box.net/2007/06/20/how-to-debug-php-with-vim-and-xdebug-on-linux/">Tutorial</a>) (Editor Plugin).</li>
  992. <li>jcx software\'s <b><a href="http://www.jcxsoftware.com/vs.php">VS.Php</a></b> (MS Visual Studio Plugin; Commercial).</li>
  993. <li><b><a href="http://code.google.com/p/xdebugclient/">XDebugClient</a></b> - Standalone Windows client.</li>
  994. </ul>
  995. </p>
  996. <p>
  997. A simple command line client for the GDB protocol is bundled with Xdebug 1.3. A
  998. client implementation of the deprecated GDB protocol can also be found in the
  999. free editor <a href="http://weaverslave.ws">WeaverSlave</a>.
  1000. </p>
  1001. <a name="starting"></a>
  1002. <h2>Starting The Debugger</h2>
  1003. <p>In order to enable Xdebug\'s debugger you need to make some configuration
  1004. settings in php.ini. These settings are [CFG:remote_enable] to enable the
  1005. debugger, [CFG:remote_host] and
  1006. [CFG:remote_port] to configure the IP address
  1007. and port where the debugger should connect to. If you want the
  1008. debugger to initiate a session when an error situation occurs (php error or
  1009. exception) then you also need to change the [CFG:remote_mode] setting.
  1010. Allowed values for this setting are "req" (the default) which makes the
  1011. debugger initiate a session as soon as a script is started, or "jit" when a
  1012. session should only be initiated on an error.
  1013. </p>
  1014. <a name="activate_debugger"></a>
  1015. <p>
  1016. After made all those settings Xdebug will still not start a debugging session
  1017. automatically when a script is run. You need to activate Xdebug\'s debugger
  1018. and you can do that in three ways:
  1019. <ol>
  1020. <li>When running the script from the command line you need to set an
  1021. environment variable, like:
  1022. <pre class="example">
  1023. export XDEBUG_CONFIG="[CFGS:idekey]=session_name"
  1024. php myscript.php
  1025. </pre>
  1026. You can also configure the [CFG:remote_host], [CFG:remote_port],
  1027. [CFG:remote_mode] and [CFG:remote_handler] in this same environment variable as
  1028. long as you separate the values by a space:
  1029. <pre class="example">
  1030. export XDEBUG_CONFIG="[CFGS:idekey]=session_name [CFGS:remote_host]=localhost [CFGS:profiler_enable]=1"
  1031. </pre>
  1032. All settings that you can set through the XDEBUG_CONFIG setting can also be set
  1033. with normal php.ini settings.</li>
  1034. <li>If you want to debug a script started through a web browser, simply add
  1035. <code>XDEBUG_SESSION_START=session_name</code> as parameter to the URL. Refer
  1036. to the <a href="#browser_session">next section</a> to read on how debug
  1037. sessions work from within a browser window.</li>
  1038. <li>Another way to activate the debugger while running PHP through a web server is by installing one of the following three browser extensions.
  1039. Each of them allows you to simply enable the debugger by clicking on one button.
  1040. The extensions are:
  1041. <a name="browser-extensions"></a><a name="firefox-ext"></a>
  1042. <dl>
  1043. <dt>The easiest Xdebug</dt>
  1044. <dd>
  1045. This <a href="https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/">extension</a>
  1046. for Firefox was built to make debugging with an IDE easier. You can
  1047. find the extension at
  1048. <a href="https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/">https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/</a>.
  1049. </dd>
  1050. <dt>Xdebug Helper for Chrome</dt>
  1051. <dd>
  1052. This <a href="https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc">extension</a>
  1053. for Chrome will help you to enable/disable debugging and profiling with
  1054. a single click. You can find the extension at
  1055. <a href="https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc">https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc</a>.
  1056. </dd>
  1057. <dt>Xdebug Toggler for Safari</dt>
  1058. <dd>
  1059. This <a href="http://benmatselby.posterous.com/xdebug-toggler-for-safari">extension</a>
  1060. for Safari allows you to auto start Xdebug debugging from within Safari.
  1061. You can get it from Github at
  1062. <a href="https://github.com/benmatselby/xdebug-toggler">https://github.com/benmatselby/xdebug-toggler</a>.
  1063. </dd>
  1064. <dt>Xdebug launcher for Opera</dt>
  1065. <dd>
  1066. This <a
  1067. href="https://addons.opera.com/addons/extensions/details/xdebug-launcher/?display=en">extension</a>
  1068. for Opera allows you to start an Xdebug session from Opera.
  1069. </dd>
  1070. </dl>
  1071. </ol>
  1072. </p>
  1073. <p>
  1074. Before you start your script you will need to tell your client that it can
  1075. receive debug connections, please refer to the documentation of the specific
  1076. client on how to do this. To use the bundled client simply start it after
  1077. <a href=install#debugclient>compiling and installing</a> it. You can
  1078. start it by running "debugclient". If you want to use the GDB commandset
  1079. to debug your scripts, make sure you use a debugclient as bundled with
  1080. Xdebug 1.3 as the one bundled with Xdebug 2 only works with the DBGp
  1081. commandset.
  1082. </p>
  1083. <p>
  1084. When the debugclient starts it will show the following information and then
  1085. waits until a connection is initiated by the debug server:
  1086. </p>
  1087. <pre class="example">
  1088. Xdebug Simple DBGp client (0.10.0)
  1089. Copyright 2002-2007 by Derick Rethans.
  1090. - libedit support: enabled
  1091. Waiting for debug server to connect.
  1092. </pre>
  1093. <p>
  1094. After a connection is made the output of the debug server is shown:
  1095. </p>
  1096. <pre class="example">
  1097. Connect
  1098. &lt;?xml version="1.0" encoding="iso-8859-1"?>
  1099. &lt;init xmlns="urn:debugger_protocol_v1"
  1100. xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
  1101. fileuri="file:///home/httpd/www.xdebug.org/html/docs/index.php"
  1102. language="PHP"
  1103. protocol_version="1.0"
  1104. appid="13202"
  1105. idekey="derick">
  1106. &lt;engine version="2.0.0RC4-dev">&lt;![CDATA[Xdebug]]>&lt;/engine>
  1107. &lt;author>&lt;![CDATA[Derick Rethans]]>&lt;/author>
  1108. &lt;url>&lt;![CDATA[http://xdebug.org]]>&lt;/url>
  1109. &lt;copyright>&lt;![CDATA[Copyright (c) 2002-2007 by Derick Rethans]]>&lt;/copyright>
  1110. &lt;/init>
  1111. (cmd)
  1112. </pre>
  1113. <p>
  1114. Now you can use the commandset as explained on the <a
  1115. href="/docs-dbgp.php">DBGp</a> documentation page. When the script ends the
  1116. debug server disconnects from the client and the debugclient resumes with
  1117. waiting for a new connection.
  1118. </p>
  1119. <a name="communication"></a>
  1120. <h2>Communication Set-up</h2>
  1121. <h3>With a static IP/single developer</h3>
  1122. <p>
  1123. With remote debugging, Xdebug embedded in PHP acts like the client, and the IDE
  1124. as the server. The following animation shows how the communication channel is
  1125. set-up:
  1126. </p>
  1127. <p align="center">
  1128. <img src="/images/docs/dbgp-setup.gif"/>
  1129. </p>
  1130. <p>
  1131. <ul>
  1132. <li>The IP of the server is 10.0.1.2 with HTTP on port 80</li>
  1133. <li>The IDE is on IP 10.0.1.42, so [CFG:remote_host] is set to
  1134. 10.0.1.42</li>
  1135. <li>The IDE listens on port 9000, so [CFG:remote_port] is set to 9000</li>
  1136. <li>The HTTP request is started on the machine running the IDE</li>
  1137. <li>Xdebug connects to 10.0.1.42:9000</li>
  1138. <li>Debugging runs, HTTP Response provided</li>
  1139. </ul>
  1140. </p>
  1141. <h3>With an unknown IP/multiple developers</h3>
  1142. <p>
  1143. If [CFG:remote_connect_back] is used, the set-up is slightly different:
  1144. </p>
  1145. <p align="center">
  1146. <img src="/images/docs/dbgp-setup2.gif"/>
  1147. </p>
  1148. <p>
  1149. <ul>
  1150. <li>The IP of the server is 10.0.1.2 with HTTP on port 80</li>
  1151. <li>The IDE is on an unknown IP, so [CFG:remote_connect_back] is set to
  1152. 1</li>
  1153. <li>The IDE listens on port 9000, so [CFG:remote_port] is set to 9000</li>
  1154. <li>The HTTP request is made, Xdebug detects the IP addres from the HTTP
  1155. headers</li>
  1156. <li>Xdebug connects to the detected IP (10.0.1.42) on port 9000</li>
  1157. <li>Debugging runs, HTTP Response provided</li>
  1158. </ul>
  1159. </p>
  1160. <a name="browser_session"></a>
  1161. <h2>HTTP Debug Sessions</h2>
  1162. <p>
  1163. Xdebug contains functionality to keep track of a debug session when started
  1164. through a browser: cookies. This works like this:
  1165. <ul>
  1166. <li>When the URL variable <code>XDEBUG_SESSION_START=name</code> is appended to
  1167. an URL Xdebug emits a cookie with the name "XDEBUG_SESSION" and as value the
  1168. value of the XDEBUG_SESSION_START URL parameter. The expiry of the cookie is
  1169. one hour. The DBGp protocol also passes this same value to the init packet
  1170. when connecting to the debugclient in the "idekey" attribute.</li>
  1171. <li>When there is a GET (or POST) variable XDEBUG_SESSION_START or the
  1172. XDEBUG_SESSION cookie is set, Xdebug will try to connect to a debugclient.</li>
  1173. <li>To stop a debug session (and to destroy the cookie) simply add the URL
  1174. parameter <code>XDEBUG_SESSION_STOP</code>. Xdebug will then no longer try
  1175. to make a connection to the debugclient.</li>
  1176. </ul>
  1177. </p>
  1178. <a name="multiple-users"></a>
  1179. <h2>Multiple Users Debugging</h2>
  1180. <p>
  1181. Xdebug only allows you to specify one IP address to connect to with
  1182. [CFG:xdebug.remote_host]) while doing remote debugging. It does not
  1183. automatically connect back to the IP address of the machine the browser
  1184. runs on, unless you use [CFG:remote_connect_back].
  1185. </p>
  1186. <p>
  1187. If all of your developers work on different projects on the same (development)
  1188. server, you can make the [CFG:xdebug.remote_host] setting for each directory
  1189. through Apache\'s .htaccess functionality by using <code>php_value
  1190. xdebug.remote_host=10.0.0.5</code>. However, for the case where multiple
  1191. developers work on the same code, the .htaccess trick does not work as the
  1192. directory in which the code lives is the same.
  1193. </p>
  1194. <p>
  1195. There are two solutions to this. First of all, you can use a <b>DBGp proxy</b>.
  1196. For an overview on how to use this proxy, please refer to the article at <a
  1197. href="http://derickrethans.nl/debugging-with-multiple-users.html">Debugging
  1198. with multiple users</a>. You can download the proxy on
  1199. <a href="http://code.activestate.com/komodo/remotedebugging/">ActiveState\'s web
  1200. site</a> as part of the python remote debugging package. There is some
  1201. more documentation in the
  1202. <a href="http://community.activestate.com/faq/komodo-ide-debugger-proxy-pydbgpproxy">Komodo FAQ</a>.
  1203. </p>
  1204. <p>
  1205. Secondly you can
  1206. use the [CFG:remote_connect_back] <b>setting</b> that was introduced in
  1207. Xdebug
  1208. 2.1.
  1209. </p>
  1210. '
  1211. ),
  1212. 'faq' => array(
  1213. 'FAQ',
  1214. 0,
  1215. 'Frequently Asked Questions',
  1216. '
  1217. <h2>Using Xdebug</h2>
  1218. <dl class="faq">
  1219. <dt>Q: phpinfo() reports that Xdebug is installed and enabled, yet I
  1220. still don\'t get any stacktraces when an error happens.
  1221. </dt>
  1222. <dd>A1: You have to search through all your PHP libraries and include files for any
  1223. "set_error_handler" calls. If there are any, you have to either comment it out,
  1224. or change the body of the handler function to call xdebug_* api functions.
  1225. </dd>
  1226. <dd>A2: You do not have set <a href="http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors">display_errors</a> to 1 in php.ini</dd>
  1227. <dt><a name="format"></a>Q: Xdebug doesn\'t format output.</dt>
  1228. <dd>A: Make sure you have PHP\'s <a href="http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors">html_errors</a> set to 1 in php.ini</dd>
  1229. <dt>Q: The debug client doesn\'t receive any connections, what do I do
  1230. wrong?</dt>
  1231. <dd>A: You probably forgot to set the environment variable or to add
  1232. the necessary information to your URL. See the
  1233. <a href=\'remote#activate_debugger\'>documentation</a> for
  1234. more information.</dd>
  1235. <dd>A: Have you checked your firewall settings? Make sure the port Xdebug is
  1236. listening on (default 9000) is not blocked.</dd>
  1237. <dd>A: Are you using FastCGI, maybe via FPM (FastCGI Process Manager)?
  1238. It uses the same port by default as Xdebug (9000)
  1239. so you will need to change one of them to a different number. In Xdebug you can
  1240. do that with [CFG:xdebug.remote_port].</dd>
  1241. <dd>A: If you are running with SELinux you should make sure it is not
  1242. preventing connections; look for warnings about <code>name_connect</code> or
  1243. anything related to the Xdebug port. You might have to allow access explicitly.
  1244. Visit <a href="http://sheltren.com/stop-disabling-selinux">this site</a> or
  1245. search for "selinux name_connect apache" for more information about how to do
  1246. this</dd>
  1247. </dl>
  1248. <h2>Compilation and Configuration</h2>
  1249. <dl class="faq">
  1250. <dt><a name="phpize"></a>
  1251. Q: I don\'t have the <code>phpize</code> tool.</dt>
  1252. <dd>A: Debian and Ubuntu users need to install the <code>php5-dev</code>
  1253. package with <code>apt</code>.</dd>
  1254. <dt><a name="api"></a>
  1255. Q: What to do with: <i>Xdebug requires Zend Engine API version
  1256. <i>xxxxxxxx</i>. The Zend Engine API version 2<i>xxxxxxxx</i> which is
  1257. installed, is newer.</i></dt>
  1258. <dd>A:
  1259. This message means that you are trying to load Xdebug with a PHP version for
  1260. which it wasn\'t built. If you compiled PHP yourself, it is most likely because
  1261. you compiled Xdebug against PHP headers that belong to a different PHP version
  1262. that you\'re running. For example, you\'re using PHP 5.3 and the headers
  1263. you\'re using are still PHP 5.2. If you are using a pre-compiled binary, then
  1264. you\'re using the wrong one.</dd>
  1265. <dd>To diagnose if this is your problem, make the following steps:
  1266. <ul>
  1267. <li>Check what the "Zend Extension" API number is of the PHP version that you
  1268. are running by looking at phpinfo() (or "php -i") output. You can find it in
  1269. the top part of the output, in the same block as the PHP logo and the PHP
  1270. version. As examples, for PHP 5.2, the number is "220060519" and for PHP 5.3 it
  1271. is "220090626".</li>
  1272. <li>Check what the output of "phpize" is when you\'re completing the
  1273. compilation steps. The number that you\'re looking for is on the line that says
  1274. "Zend Extension Api No".
  1275. </ul>
  1276. <p>
  1277. If the two numbers from above do <b>not</b> match, you\'re compiling with the
  1278. wrong PHP headers. Refer to the next <a href="/docs/faq#custom-phpize">FAQ
  1279. entry</a> to figure out which phpize to use.
  1280. </p>
  1281. </dd>
  1282. <dt><a name="php-ext"></a>Q: Xdebug is only loaded as PHP extension and not as a Zend Extension.</dt>
  1283. <dd>
  1284. <p>The tailored installation intstructions might have you pointed to this entry.</p>
  1285. <p>In order for Xdebug to work properly, including breakpoints etc. it is required that it is loaded
  1286. as a Zend extension, and not just as a normal PHP extension. Some installation
  1287. tools (PEAR/PECL) sometimes advice you to use <code>extension=xdebug.so</code>
  1288. to load Xdebug. This is <b>not</b> correct. In order to fix this issue, please
  1289. look for a line <code>extension=xdebug.so</code> in any of the INI files that
  1290. are listed under "Loaded Configuration File" and "Additional .ini files parsed"
  1291. in the top block. Remove this line, and go back to the
  1292. <a href="/wizard.php">Tailored Installation Instructions</a>.</p>
  1293. </dd>
  1294. <dt><a name="custom-phpize"></a>
  1295. <dt>Q: How do I find which phpize to use?</dt>
  1296. <dd>A:
  1297. Run: "phpize --help". This shows you the full path to
  1298. phpize. This path should be the same as where you have the CLI binary,
  1299. "php-config" and the "pear" and "pecl" binaries <b>installed</b>. If you
  1300. run "php-config --version" it should show the same version of PHP that
  1301. you\'re running. If it doesn\'t match up, and perhaps the wrong "phpize"
  1302. binary is found on the path, you can run configure as follows:
  1303. <ol>
  1304. <li>/full/path/to/php/bin/phpize</li>
  1305. <li>./configure --with-php-config=/full/path/to/php/bin/php-config</li>
  1306. </ol>
  1307. </dd>
  1308. <dt>Q: I\'m using XAMPP, but I can\'t seem to get the packaged xdebug extension
  1309. to work properly.</dt>
  1310. <dd>A: If you uncommented the "extension=php_xdebug.dll" line, that is to be
  1311. expected. Xdebug <b>needs</b> to be loaded with the zend_extension_ts=
  1312. "C:\path\to\php_xdebug.dll" directive. You\'ll also likely have to disable the
  1313. loading of the Zend Optimizer, since it\'s enabled by default, and doesn\'t work
  1314. well with Xdebug. So look for the related entry in php.ini, and comment it out.
  1315. <strong>From PHP 5.3 onwards, you always need to use the zend_extension PHP.ini
  1316. setting name, and not zend_extension_ts.</strong>
  1317. </dd>
  1318. <dt>Q: On Debian, I am seeing the following problem with the build of
  1319. Xdebug.... any fixes?
  1320. <pre>
  1321. /usr/lib/libc_nonshared.a(stat.oS)(.text.__i686.get_pc_thunk.bx+0x0):
  1322. In function `__i686.get_pc_thunk.bx\':
  1323. : multiple definition of `__i686.get_pc_thunk.bx\'
  1324. /usr/lib/gcc-lib/i486-linux/3.3.5/crtbeginS.o
  1325. (.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0): first defined here
  1326. collect2: ld returned 1 exit status
  1327. make: *** [xdebug.la] Error 1 </pre>
  1328. </dt>
  1329. <dd>A: This is an issue with Debian itself, see for more information
  1330. <a href="http://www.xdebug.org/archives/xdebug-general/0825.html">here</a>
  1331. and <a href="http://www.xdebug.org/archives/xdebug-general/0825.html">here</a>.
  1332. </dd>
  1333. </dl>
  1334. '
  1335. ),
  1336. );
  1337. ?>