When you encounter issues with your Drupal site, there are a few ways and places you can look for clues to your problem.
- 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.
- 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:
- .htaccess config problems - "Internal server error" - Error 500 directive not allowed here
- Memory problems Fatal error: Allowed memory size of 8388608 bytes exhausted
- 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.
- 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.
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.
The README.txt file can contain the following:
- General information and advice from the contributor(s)
- Dependencies (such as server PHP extensions)
- Installation instructions
- Cavaets (such as module conflicts and patches)
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.
- 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: This is an excerpt from here.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/httpd/global/drupal/modules/node.module on line 1303.
- 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
- 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.
- 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.