Debugging: Difference between revisions
No edit summary |
ini examples; typo; reference links |
||
| Line 22: | Line 22: | ||
'''Extensions directory:''' /usr/lib/php5/20121212+lfs | '''Extensions directory:''' /usr/lib/php5/20121212+lfs | ||
</blockquote> | </blockquote> | ||
Caveat: | Caveat: the wizard can't really tell where the xdebug configuration lives (in the case of many subsidiary ini files). In Ubuntu, there might be a file in <code>/etc/php5/conf.d</code> In my case I actually did have <code>/etc/php5/conf.d/xdebug.ini</code>, but that file is superfluous because there are symbolic links for both '''apache2''' and '''cli''' that go to | ||
<code>/etc/php5/mods-available/xdebug.ini</code> (which helps PHP configuration to be the same for both runtimes.) Bottom line: run <code>locate xdebug.ini</code> to find out whether you have a duplicate/conflicting file; merge those files down to one; and make any overrides that you need from the default settings which xdebug will use if left unconfigured. Then <code>sudo service apache2 restart</code> and check | <code>/etc/php5/mods-available/xdebug.ini</code> (which helps PHP configuration to be the same for both runtimes.) Bottom line: run <code>locate xdebug.ini</code> to find out whether you have a duplicate/conflicting file; merge those files down to one; and make any overrides that you need from the default settings which xdebug will use if left unconfigured. Then <code>sudo service apache2 restart</code> and check the output of <code>phpinfo()</code> for correctness. | ||
The defaults are probably all good, but you | The defaults are probably all good, but you may want to specify some of the following: | ||
<source lang="ini"> | <source lang="ini"> | ||
;zend_extension=/usr/lib/php5/20090626+lfs/xdebug. | ; the old one installed by apt-get | ||
; zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so | |||
; as of php 5.5 you no longer need to supply a full path to the zend_extension= token | |||
; but it doesn't hurt, and may be required if you have multiple .so files lying around | |||
zend_extension=/usr/lib/php5/20121212+lfs/xdebug.so | |||
; enable debugging | ; enable debugging | ||
| Line 36: | Line 40: | ||
xdebug.remote_host = "192.168.1.0/24,127.0.0.1" | xdebug.remote_host = "192.168.1.0/24,127.0.0.1" | ||
; set which debug client protocol we want | ; set which debug client protocol we want | ||
xdebug.remote_handler = "dbgp" | xdebug.remote_handler = "dbgp" | ||
; enable anyone with access to the machine to start a debugging session | |||
; this setting also helps when you're having difficulty with the connection setup | |||
; xdebug.remote_connect_back 1 | |||
</source> | </source> | ||
Once you see xdebug in your phpinfo() output, you know it's enabled -- which means that you can already get xdebug functionality out of your PHP scripts (e.g. var_dump() is overridden). But how do you get debugging working so that you can use it with your IDE? That is covered in the '[http://www.xdebug.org/docs/remote remote]' section of the manual. | Once you see xdebug in your <code>phpinfo()</code> output, you know it's enabled -- which means that you can already get xdebug functionality out of your PHP scripts (e.g. var_dump() is overridden). But how do you get debugging working so that you can use it with your IDE? That is covered in the '[http://www.xdebug.org/docs/remote remote]' section of the manual. | ||
{{Highlight | | |||
text= If you want to use [https://secure.php.net/manual/en/opcache.installation.php OPcache] with Xdebug, you must load OPcache before Xdebug. In general, extensions are loaded in the order found in php.ini. See https://wiki.php.net/internals/extensions and [https://wiki.php.net/_detail/internals/extensions_lifetime.png?id=internals%3Aextensions this graphic] for more info}} | |||
Following the sage advice of the [http://wiki.netbeans.org/HowToConfigureXDebug#General_Information Netbeans wiki], you want to get xdebug's '''debugclient''' working on localhost first, then add Netbeans. | Following the sage advice of the [http://wiki.netbeans.org/HowToConfigureXDebug#General_Information Netbeans wiki], you want to get xdebug's '''debugclient''' working on localhost first, then add Netbeans. | ||