FeaturesWP CloudPricingEE CLIContactMy Account

Features

Team Access & User Permissions

Server Setup & Management

Site Creation & Management

Deployments & Developer Tools

Firewall Protection

Speed & Caching

Backups & Recovery

Logs & Monitoring

Create WP Cloud Sites

All Features

Read Documentation

Install

Installation Guide

FAQ

Roadmap

Explore EE CLI

Resources

Commands

Handbook

Blog

Community

Forum

EasyExperts

Tutorials

Subscribe

Github

CLEAR

Start For Free

separator Tutorials separator PHP separator Install Xdebug and configure it with webgrind

Topics

On this page

For EasyEngine Users…

Installing Xdebug

Install Webgrind

Install graphviz and Gprof2Dot

Webgrind config

Using Webgrind

Trigger Profiling

Always Profile

Remote Profiling

Install Xdebug and configure it with webgrind

For EasyEngine Users…

You can use ee debug command which automates some part.

Installing Xdebug

  1. Install Xdebug for php

			sudo apt-get install php5-xdebug
		
  1. Setup xdebug.ini for ubuntu

			vim /etc/php5/fpm/conf.d/20-xdebug.ini
		

Add following lines:

xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=cachegrind.out.%p-%H-%R
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0

3. Restart php5-fpm

sudo service php5-fpm restart

Install Webgrind

Under webroot for example.com, run following commands:

wget https://github.com/jokkedk/webgrind/archive/master.zip
unzip master.zip
mv webgrind-master webgrind

Install graphviz and Gprof2Dot

This is needed for graphical presentation of calls.

apt-get install python graphviz

Webgrind config

Open config.php under webgrind folder. You may need to specify location of dot binary.

static $dotExecutable = '/usr/bin/dot';

Using Webgrind

Goto http://example.com/webgrind in your browser and you will see webgrind UI there.

But wait, you may not see any output there as cachegrind files may not have created yet.

Trigger Profiling

You may not see anything as we have set xdebug to profile only on trigger. This is good for profiling sites used in production environment as well as on server with multiple sites using same PHP pool.

You can use this browser extension to trigger profiling:

Always Profile

Be warned, that this can eat up GB’s of space on a live server with decent traffic in an hour!

You can change a line like below and it will profile php code always.

xdebug.profiler_enable=1

Of course, you will need to reload PHP for change to take effect using service php5-fpm reload

Remote Profiling

We have covered remote debugging with Netbeans here: https://easyengine.io/tutorials/php/xdebug-netbeans/. Please note that changes to debug config in NetBeans article, if you decide to use it.

Xdebug site has more remote options.

For more details, check out the Xdebug Documentation.

Having php5 and php7 on same system.

PREVIOUS

Installation of PHP Code Review Tools

NEXT


Features

Useful Links

Product

Other Products

Subscribe for curated product updates, tips, and announcements.

"*" indicates required fields

Phone

This field is for validation purposes and should be left unchanged.

Email*

SIGN ME UP

Δ


© rtCamp, since 2009. All rights reserved.

Powered by