5) Debugging and Profiling (XHProf, etc)

Last updated on
30 April 2025

See drupalquickstart's Channel on Youtube for details on how to debug in Netbeans, and profile with XDebug and Webgrind.

Here's a short version of how to get XHProf to profile your Drupal 7 site.

From the command-line install the devel module with drush:

cd ~/websites/example.dev
drush dl devel
drush pm-enable devel

Then login to the site and configure it: http://example.dev/admin/config/development/devel

Check "Enable profiling of all pages ..."
xhprof directory: /home/quickstart/websites/logs/xhprof
xhprof URL: http://localhost/xhprof
Click "Save"

At the bottom will be a link to "XHProf..."

Click this to view the profile information for that page.

IMPORTANT! While XHProf is on, it will save a profile image for every page load (~ 150k). If you leave it on, these old profiles will start to add up.

To clean out these old profiles, do this:

sudo rm ~/websites/logs/xhprof/*.*

Help improve this page

Page status: Not set

You can: