Add XDebug debugging information

This commit is contained in:
Robin McCorkell
2015-08-31 15:01:51 +01:00
parent fd685b95d0
commit b9e36c9749

View File

@@ -41,6 +41,35 @@ not:
To disable custom error handling in ownCloud (and have PHP and your web server handle errors instead), see Debug mode.
Using a PHP debugger (XDebug)
-----------------------------
Using a debugger connected to PHP allows you to step through code line by line, view variables at each line and even change values while the code is running. The de-facto standard debugger for PHP is XDebug, available as an installable package in many distributions. It just provides the PHP side however, so you will need a frontend to actually control XDebug. When installed, it needs to be enabled in :file:`php.ini`, along with some parameters to enable connections to the debugging interface:
.. code-block:: ini
zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
XDebug will now (when activated) try to connect to localhost on port 9000, and will communicate over the standard protocol DBGP. This protocol is supported by many debugging interfaces, such as the following popular ones:
- vdebug - Multi-language DBGP debugger client for Vim
- SublimeTextXdebug - XDebug client for Sublime Text
- PHPStorm - in-built DBGP debugger
For further reading, see the XDebug documentation: http://xdebug.org/docs/remote
Once you are familiar with how your debugging client works, you can start debugging with XDebug. To test ownCloud through the web interface or other HTTP requests, set the ``XDEBUG_SESSION_START`` cookie or POST parameter. Alternatively, there are browser extensions to make this easy:
- The Easiest XDebug (Firefox): https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/
- XDebug Helper (Chrome): https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc
For debugging scripts on the command line, like ``occ`` or unit tests, set the ``XDEBUG_CONFIG`` environment variable.
Debugging Javascript
--------------------