Ubuntu 16.04 PHP7 Xdebug

Ubuntu 16.04 terminal commands

sudo apt-get update && sudo apt-get install php-xdebug && php -m && service apache2 restart

Note: Using && executes multiple commands one after another.


To turn on Xdebug and add addtional features, run

sudo nano /etc/php/7.0/mods-available/xdebug.ini

Add the following


Note: You can copy and paste these quickly if you're using a terminal window. To paste, press crtl+shift+v to paste within a terminal screen. Highlight then press crtl+shift+c to copy.

What does each Xdebug parameter mean?


Type: integer, Default value: 0, Introduced in Xdebug >= 2.4

When this setting is set to 1, Xdebug will show a stack trace whenever an Error is raised - even if this Error is actually caught.


Type: boolean, Default value: 0, Introduced in Xdebug >= 2.1

If enabled, the xdebug.remote_host setting is ignored and Xdebug will try to connect to the client that made the HTTP request. It checks the $_SERVER['HTTP_X_FORWARDED_FOR'] and $_SERVER['REMOTE_ADDR'] variables to find out which IP address to use.

If xdebug.remote_addr_header is configured, then the $SERVER variable with the configured name will be checked before the $_SERVER['HTTP_X_FORWARDED_FOR'] and $_SERVER['REMOTE_ADDR'] variables.

This setting does not apply for debugging through the CLI, as the $SERVER header variables are not available there.

Please note that there is no filter available, and anybody who can connect to the webserver will then be able to start a debugging session, even if their address does not match xdebug.remote_host.


Type: boolean, Default value: 0

This switch controls whether Xdebug should try to contact a debug client which is listening on the host and port as set with the settingsxdebug.remote_host and xdebug.remote_port. If a connection can not be established the script will just continue as if this setting was 0.

The above was a copy and paste for Xdebug's documention. Please refer to Xdebug's documentation for more information.


Leave a comment