Community Documentation

ARCHIVE: Drupal troubleshooting guide

Last updated October 1, 2011. Created by dman on July 4, 2006.
Edited by JuliaKM, forestmonster, figaro, vfranklyn. Log in to edit this page.

When you encounter issues with your Drupal site, there are a few ways and places you can look for clues to your problem.

  1. Stop and think
    • Identify what changes you've made recently, including modules you've recently installed or updated.
    • Double check the version of the module(s) you installed matches your version of Drupal.
  2. Read the error messages. Drupal-specific error messages may display on the page, or you can find them in Administer/Reports/Recent log entries.

    You may want to also check non-Drupal logs, such as Apache, PHP, etc.

    Errors may include:

  3. Validate your page
    Incomplete markup tags and structural problems may cause your layout problem - alignment, font size, overflowing blocks, etc. Though you may not be able to solve all validation issues, you should know what errors exist, and how important they are.
    The web developer toolbar has tools to help you, including the "Validate local HTML" option, which lets you validate non-public sites.
  4. Check your CSS
    Some rules will override others, so Learn about the first 'C' in CSS - the Cascade.
  • Check container and child elements - the margin for one item may be the padding for another (particularly in list items).
  • Don't hack core - If you find unwanted CSS coming from a core Drupal file, override it in a new style.css file using the same rule pattern.

You can inspect your CSS with these tools:

  • FireBug - for Firefox
  • Web Developer Toolbar - for Firefox, Flock, and Seamonkey
  • DOM inspector - for Internet Explorer
    • Open DOM inspector.
    • Use the 'Select element by click' pointer and click on the problem element.
    • Navigate the DOM tree to ensure it's the right element.
    • Look at the 'CSS Style Rules' pane.
    • Click through the 'Rules' and find out all the places where the element gets its formatting from.
  • Clear Drupal's cache
    To enhance performance, Drupal builds a cache of requested resources. When Drupal answers your request for a page, it may include cached portions, instead of incorporating your most recent changes. To address this problem, you can clear any or all of Drupal's caches, and receive only newly generated pages. Note that each of your page requests will rebuild the cache of that page's resources.
    • To clear all caches, click the "Clear all caches" button located under the Performance admin menu entry.
    • Though the location may change with future Drupal versions, in Drupal 7, this can be reached at Administration > Configuration > Development > Performance.
  • Read the README
    The README.txt file can contain the following:
    • General information and advice from the contributor(s)
    • Dependencies (such as server PHP extensions)
    • Requirements
    • Installation instructions
    • Cavaets (such as module conflicts and patches)
  • Search the proper way. If the error you see (in the log or the screen) doesn't make sense to you, try a search on it. Use Google, and quote the error as best you can. Google: "Argument #1 is not an array" drupal. - A google on a phrase, plus the keyword 'drupal' is probably better than a drupal.org search. Take care to leave out pathnames (but filenames are probably useful). Try different permutations of quotes around what seem to be discreet parts of the message. Try searching both with and without arguments. Strings input by the user won't help much when searching for the problem elsewhere.
  • Identify the source of the problem.
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(n.nid), n.title FROM category c INNER JOIN category_node r ON c.cid = r.cid INN' at line 1 ...  in /var/www/html/doadance/drupal/includes/database.mysql.inc on line 120.

    Errors like the above are not caused by drupal database.inc. They are simply found by it because a module has sent some bad instructions to the internals. We need to find where the call came from, unfortunately you won't get a call stack by default. Try to identify the table being addressed in this query to see what module may be doing it. In this case it looks like category, but it may in fact be any other module that's trying to directly access data about categories.
  • Dump some diagnostics. Debugging. If you are really trying to find the causes, it may help to display some of the code.
    • Try the devel.module. It's got lots of useful functionality.
    • For one-off quick hacks, try some lightweight code, for instance when you just want to know why you are seeing the following:
      warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/httpd/global/drupal/modules/node.module on line 1303.
      This is an excerpt from here.
    • Go look at that file. Modify it a bit. It's safe to do so if you remember to undo afterwards.
    • On line 1303, node.module we find in_array('status', $node_options).
    • on the line before try inserting the code: print("Node options are : '".print_r($node_options,1)."'"); and see if that gives any clue.
    • A useful data dump when debugging, even within node pages themselves is sometimes. print("Node is : ".print_r($node,1)");, Devel.module provides much better tools, like dsm() and even provides a data dump of nodes as an automatic tab.
  • Ask the right questions. When posting questions on the Drupal forum, it's usually better to post more info than less. The more work you can demonstrate has gone into solving it already, the more likely folks are to help you get the rest of the way. Do ask questions "The smart way". Do follow up in the same thread if you resolve it - even if no-one else posted. Do consider submitting your solution as a comment under Troubleshooting FAQ or the elsewhere in the handbook. In Drupal, it's usually important to know if you are on a shared hosting provider - mention this!
  • Identify the module that's giving you problems. All Drupal 'pages' are dynamically created to one extent or another. The URL where dynamically created pages are published is usually defined in a module's hook_menu() implementation. When installing or investigating new modules, it's usually interesting to open up the code and look at the ***_menu() function to see what it does. Conversely, if you want to find which module is serving which page, you'll have the search there also. To answer a question like "how is my sites rss.xml created?", a troubleshooting process may be:
    • Do a find-in-files for "rss.xml"
    • This returns, sure enough, a result in node.module : node_menu()
    • This tells us that the function in question - that serves that page - is node_feed(). This is where you want to look for further details.
    • All dynamic pages can be debugged by starting like this. Look at the URL, identify the module that serves that URL, trace the callback through the code.
  • Page status

    No known problems

    Log in to edit this page

    About this page

    Audience
    Site administrators

    Archive

    Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
    nobody click here