Moodle 3.x Developer's Guide
上QQ阅读APP看书,第一时间看更新

Configuring remote debugging

We will use the Chrome browser for development using the integrated JavaScript, CSS, and HTML debugging tools. To debug PHP scripts, we will need to install and configure a PHP remote debugger. The debugger we will use is called Xdebug--https://xdebug.org/index.php. Xdebug needs to be installed and configured in three places:

  • The web server (Apache running our local development server)
  • The development environment (Eclipse)
  • The browser (Chrome)

The first step is to configure Xdebug in Apache. In order to determine which version of Xdebug is required, you will need to obtain a copy of the full output from phpinfo()--refer to http://php.net/manual/en/function.phpinfo.php--and paste that into https://xdebug.org/wizard.php, as follows:

Press the Analyse my phpinfo() output button at the bottom of the page for instructions on how to download and configure Xdebug.

Next, we need to configure Xdebug in the IDE. Instructions are available in the Eclipse documentation at https://wiki.eclipse.org/Debugging_using_XDebug.

Finally, we need to install an Xdebug plugin into the browser. For Chrome, we will be using Xdebug helper. Check out https://github.com/mac-cain13/xdebug-helper-for-chrome for details, but the helper itself is easily installed through the Chrome Web Store (you can find relevant links on the GitHub page).