We’re rewarding the question askers & reputations are being recalculated! Read more.
50

On a development site I would suggest uncommenting the following lines in the settings.php file. emacs sites/default/settings.php if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; } and then copying the file example.settings.local.php from /sites folder to /sites/default folder and rename it to settings....


38

Use dpm($wrapper->getPropertyInfo()); It's in the docs.


36

It's a wee bit of a hack, but you could add a tag to any EntityFieldQuery you're interested in printing the query for, then implement hook_query_alter() to intercept it when it's a standard SelectQuery, then cast it to string for debugging: function MYMODULE_query_alter($query) { if ($query->hasTag('efq_debug')) { dpm((string)$query); } } $q = ...


35

Good god Batman. That was incredibly frustrating. Here's a guide to getting xhprof working. (Note: I am very new to Linux. I'm not sure if the permissions I use are safe, or whether there is a better way of doing it. I'd only do this on a test environment.) IMPORTANT: It won't tell you anything about how to interpret it. I have no idea how to, I'm just ...


29

The error: EntityMalformedException: Missing bundle property on entity of type node. happens, because your bundle property is malformed either on load or save, so Drupal can't find what type of bundle is it. The logic of that Exception is: // Explicitly fail for malformed entities missing the bundle property. if (!isset($entity->{$info['entity keys']...


29

Not really. Since Drupal 7.33 release there is now simple support for alternative template support and themeing function alternatives listing in Drupal (core) by adding a setting in settings.php. Added a "theme_hook_original" variable to templates and theme functions and an optional sitewide theme debug mode, to provide contextual information in the page'...


28

Make sure you have print $messages; in your page.tpl.phptemplate file. By default, devel (dpm) is configured to print it's content in the message area of the site. So if your template for some reason does not render the contents of $messages, you won't see anything.


27

This error comes from an uncaught PHP exception. Drupal catches exceptions so no ugly PHP error message is displayed to user. You can find the exception info in the 'Recent log messages' link on Reports (or try this path: /admin/reports/dblog). Make sure 'Database logging' module is enabled because this module provides this report. You will see all the ...


21

One way you can do is make a custom module, print access info on every page, every node, every block. menu_get_item() function return a router item which has access_arguments property for current page. /** * Show access permission of current page. */ function yourmodule_get_page_access() { $router_item = menu_get_item(); if ($router_item) { $...


19

It's not. It's printed. However, notices are by default not visible unless you increase the verbosity of drush using the -v option. To display internal messages you'll need to enable debug option -d. This will display even more information. Alternatively, you can change the message type parameter from 'notice' to 'ok' to print out to the console. ...


18

Add the following line in the settings.php file. $config['system.logging']['error_level'] = 'verbose'; See Make developer tricks / tools for D8 more discoverable/obvious for more details.


15

You can use the Devel module, and select one of the "Krumo Backtrace" options it provides in its configuration page at admin/config/development/devel. Make sure to visit admin/config/development/logging and select "Errors and Warnings" or "All Messages". If you have the Syslog module, or any other logging module enabled, you may need to disable it and ...


15

Drupal 6 & 7 If using Drush, just do drush vset error_level 1. Otherwise, go to "/admin/config/development/logging" and change the setting to "Errors and Warnings" Drupal 8 Instead of drush vset/vget/vdel, you can use cset/cget/cdel for config values and sset/sget/sdel for state values.


13

Sometimes krumo($variable) might work when dpm($variable) doesn't. Sometimes print dpm($variable) might work when dpm($variable) doesn't. might also be the solution when there's no print $messages in your page.tpl.php anymore. Maybe you can add it back.


13

No that is impossible. What you could do is give access to devel for all users. You shouldn't be using devel in a live environment anyways, so just make sure you remove devel and revoke permissions before staging to production environment.


13

Rather than rolling your own hook_query_alter() you can let Devel module do the heavy lifting for you by adding the debug tag: $q = new EntityFieldQuery; $q->entityCondition('entity_type', 'node'); ->addTag('debug') ->execute(); This will print the query to screen, just like dpq() would.


13

Give them Access developer information permission at admin/people/permissions. Note that this opens a huge security risk so make sure you revoke it when you are done with debugging.


11

Start a custom module, insert this code: /** * Implements hook_form_alter(). */ function foo_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'search_theme_form') { dpm($form); } } Also, you might want to use dpm() over dsm() since the latter is a legacy function.


11

EASY WAY Edit your settings.php and add a line there (especially on your dev site, you can just keep this on) $conf['error_level'] = 1; drush requires you being able to bootstrap the database.


11

Someone tried to create a module to provide shell access from within a Drupal site, but it was never fully debugged. See the Drupal Terminal project. Perhaps there have been advances in the jQuery terminal that might make it easier to get this working if someone revisited it. If you want to exec Drush from within php, it is generally better to use ...


10

dpm() does not print any protected properties and it also doesn't know about methods. That's especially bad for content entities but applies to most objects in 8.x now. The issue referenced in the answer from Daniel Wehner adds Kint, which is already much better, as it will give you protected properties and methods. However, for content entities, it still ...


10

You can put this in your settings.php $conf['theme_debug'] = true; This outputs html comments on your page which will help you with debugging how the theme suggestions are selected.


10

Option 1: Use the Disable Messages module Use the Disable Messages module for this. Here is a quote from its project page: Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal ...


10

You can use watchdog but the message part should be translatable, so any variables should use placeholders defined in the variables array. Check out format_string to see how these should work. watchdog( 'my_module_name', 'Here is the printed variable: <pre>@placeholder_name</pre>', array('@placeholder_name' => print_r( $my_variable, ...


10

I agree with the comment left for the question: It seems you have an out of memory issue. Check the error log for the server. I had the same problem with dump() and kint() in an implementation of template_preprocess_views_view_field(), while trying to output the content of a row, on a clean and fresh Drupal 8 installation. I found a workaround for kint(), ...


10

What is easiest way to debug variables in nodes,views,blocks and page template. Using Devel Kint, which comes with the Devel module. Welcome to Kint 101 Important: in order to use kint() in a twig file you need to enable debuging for twig. You enable Twig Debugging in sites/default/services.yml. (If services.yml does not yet exist; copy default....


9

I just finally installed the XHProf profiler under Windows7 x64 - PHP 5.3.x. Assuming that you have a functional PHP environment, this checklist should work for you too: Download the pre-compiled XHProf 0.10.3 - PHP 5.3 VC9 NTS binary. Paste the downloaded dll file to PHP extensions directory. (You can find the directory path in extension_dir directive ...


9

Unless you get a fatal error (or blank screen) it's pretty easy to get a list of modules that will invoked when a special hook is called: $modules = module_implements($hook); foreach ($modules as $key => $module) { $function = $module . '_' . $hook; if (!function_exists($function)) { unset($modules[$key]); } } // $modules is now an array ...


9

You must be logged-in to the Drupal site, with the correct permissions to access Devel. Log in as admin should do it.


9

I'd highly recommend devel_debug_log. It requires the devel module, and it gives you the ddl() function. ddl adds a page to your reports in configuration, so it's similar to printing to watchdog, but you have a nice clean page where you can send your debug messages, and not worry about race-type conditions where your messages might get cleared before you ...


Only top voted, non community-wiki answers of a minimum length are eligible