Skip to content

Instantly share code, notes, and snippets.

@mikesmullin
Last active July 15, 2018 16:59
Show Gist options
  • Save mikesmullin/623340 to your computer and use it in GitHub Desktop.
Save mikesmullin/623340 to your computer and use it in GitHub Desktop.
HOWTO: Configure PHP with Xdebug plugin
# Setup debugging with Xdebug
# apt wont install for php5.2, so build
cd /tmp
wget http://xdebug.org/files/xdebug-2.1.4.tgz
tar zxvf xdebug-2.1.4.tgz
cd xdebug-2.1.4/
sudo apt-get install php5-dev
phpize
./configure
make
sudo cp modules/xdebug.so /usr/lib/php5/20090626/ # may have changed; use tabcomplete and also update below
# configure
sudo vim /etc/php5/conf.d/xdebug.ini
; Replace with the following lines,
; making sure the path to your xdebug.so is correct,
; and your IP address also:
[xdebug]
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=10.1.9.36
;xdebug.remote_handler=dbgp
;xdebug.remote_mode=jit
;xdebug.remote_log=/etc/apache2/logs/xdebug_remote
;xdebug.max_nesting_level=100
;these are supposed to work, but they get overridden by the remote debugger client
;xdebug.var_display_max_children=128 ; this is the one that controls array chunking into 32 pieces at a time
;xdebug.var_display_max_data=512
;xdebug.var_display_max_depth=3
;xdebug.profiler_enable=On
xdebug.profiler_output_dir="/tmp"
xdebug.profiler_output_name="callgrind.out.%u-%H-%R"
:wq
php -v # test
# should say
# PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:03:45)
# Copyright (c) 1997-2009 The PHP Group
# Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
# with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans
# then restart apache to load xdebug module
sudo service apache2 restart # to pick up changes to xdebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment