← ServerPilot Docs

How to Install the PHP Xdebug Extension

In the examples shown, replace "X.Y" with your app's PHP version (for example, "5.4" or "7.0"). To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.

The Xdebug extension provides debugging and profiling capabilities for PHP scripts.

Xdebug supports PHP 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, and 7.3.

Installing Xdebug on PHP 5.5+ and PHP 7.0+

To install this extension, run the following commands as your server's root user:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config

For PHP 5.5, 5.6, 7.0, 7.1, and 7.2

sudo peclX.Y-sp install xdebug

For PHP 7.3:

sudo pecl7.3-sp install xdebug-beta

Once installed, create a configuration file by running the following command run as root.

sudo bash -c "echo zend_extension=xdebug.so > /etc/phpX.Y-sp/conf.d/xdebug.ini"

Finally, restart PHP by running this command as root:

sudo service phpX.Y-fpm-sp restart

Installing Xdebug on PHP 5.4

To install this extension, run the following commands as your server's root user:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl5.4-sp install xdebug

Once installed, create a configuration file by running the following command run as root.

sudo bash -c "echo zend_extension=/opt/sp/php5.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so > /etc/php5.4-sp/conf.d/xdebug.ini"

Finally, restart PHP by running this command as root:

sudo service php5.4-fpm-sp restart

Verifying the Installation

You can verify Xdebug is installed correctly by running the command

phpX.Y-sp -i | grep xdebug

If you installed Xdebug correctly, you will see the following:

/etc/phpX.Y-sp/conf.d/xdebug.ini,
xdebug
xdebug support => enabled
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.file_link_format => no value => no value
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 100 => 100
xdebug.overload_var_dump => On => On
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => Off => Off
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.scream => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3

Uninstalling the Xdebug Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/xdebug.ini
sudo peclX.Y-sp uninstall xdebug

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes