Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
- Stop and think
- Have you made any recent changes to your site such as:
- installing new modules?
- updating existing modules?
- making configuration changes?
- granting or revoking permissions?
- Does the version of the module you installed match your version of Drupal? For example, Views for Drupal 7 will not work on a Drupal 6 site.
- Have you made any recent changes to your site such as:
- Read the error messages. Depending on how you have set your error messages to display, Drupal-specific error messages may display on the page. When the core dblog module is enabled, you can find error reports at
/admin/reports/dblog
. When debugging, you should also check non-Drupal logs, such as Apache, PHP, etc. Your hosting provider can help you locate these logs.Errors may include:
- .htaccess config problems - "Internal server error" - Error 500 directive not allowed here
- Memory problems - Fatal error: Allowed memory size of 8388608 bytes exhausted
- JavaScript problems - modules/troublesome/utility.js 404 file not found.
- Validate your page
Incomplete HTML markup tags and structural problems can cause problems with your site theme such as misalignment, incorrect font sizes, overflowing blocks, etc. As you debug your site, go through each error message and evaluate why the error exists and how important it is to solve. You might not be able to solve all validation issues, but you should be aware of why each one exists. - Check your site's CSS
Your site may not be displaying correctly because one CSS rule is overriding another one. If you are unfamiliar with CSS, your first step should be to learn more about cascading. Once you are familiar with CSS, look to child and container elements for possible issues. In particular, the margin for one item may be the padding for another (particularly in list items). Additionally, when you need to override the CSS of your site, do so in a new style.css file in your theme, not by modifying core files.You can inspect your site's code with these tools:
- FireBug - for Firefox
- Web Developer Toolbar - for Firefox and Chrome
- DOM Explorer - part of F12 Developer Tools included with IE11
- 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 an older cached version that does not reflect a recent change. To address this problem, you can clear any or all of Drupal's caches, and receive only newly generated pages.- Drupal 6: To clear all caches, click the "Clear all caches" button at the bottom of
/admin/settings/performance
. - Drupal 7: To clear all caches, click the "Clear all caches" button at the top of
/admin/config/development/performance
.
- Drupal 6: To clear all caches, click the "Clear all caches" button at the bottom of
- Read the README for your modules
The README.txt file for a module often contains:- General information and advice from the contributor(s)
- Dependencies (such as server PHP extensions)
- Requirements
- Installation instructions
- Caveats (such as module conflicts and patches)
- Search for your error
Thanks to Drupal's popularity, chances are that someone has run into your problem before. Use Google to search for your error message. When searching, be sure to remove any paths that are specific to your local or hosting environment and to include quotes around your error message. Adding the word "drupal" to your search, can help return more accurate results. For example, Google: "Argument #1 is not an array" drupal. - Dive into code to identify the source of SQL errors.
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 this are almost never caused by Drupal's core code. Instead, they are often the result of a contributed or custom module sending bad instructions to Drupal. When debugging, try to identify the database table being addressed in this query to identify which module may be the culprit. In this case it looks like the category module. However, the cause may be another module that's trying to directly access data about categories.
- Debug by diving into module code
The best way to find the source of a problem is often to display the code involved. If it is not already installed, your first step should be to install the Devel module Here's a step-by-step approach to finding and debugging this error:warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/httpd/global/drupal/modules/node.module on line 1303.
- Go to line 1303 of node.module. You are going to make changes to the file so first save a backup copy or make sure your version control is up-to-date.
- On line 1303, node.module locate
in_array('status', $node_options).
- on the line before insert the code:
print("Node options are : '".print_r($node_options,1)."'");
. - Look through the output and try and identify where the wrong datatype is coming from.
- Ask questions that lead to answers
When posting questions on the Drupal forum, make sure to ask questions the smart way. Once your problem is resolved, make sure to follow-up in the same thread. - Identify the module that's giving you problems
Once you find the module that's causing problems, open its .module file. The module's custom pages are usually defined within hook_menu(). Many modules can be debugged by first looking at a URL, then identifying the module serving the content, and finally looking for the code using hook_menu() and .module files.