Debugging

The debugging feature of Xdebug can be easily turned on with the xdebug.remote_enable=1 option. With modern PHP, there is usually a special xdebug.ini configuration file; otherwise, we would edit the default php.ini file. With our Ubuntu installation, we add this to the /etc/php/7.0/apache2/conf.d/20-xdebug.ini file as follows:

zend_extension=xdebug.soxdebug.remote_enable=1

Once the file has been modified, we need to make sure the Apache server is restarted:

 service apache2 restart 

While xdebug.remote_enable is the required option to turn on the debugging feature, other related options include the following:

  • xdebug.extended_info
  • xdebug.idekey
  • xdebug.remote_addr_header
  • xdebug.remote_autostart
  • xdebug.remote_connect_back
  • xdebug.remote_cookie_expire_time ...

Get Mastering PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.