$100 Website Offer

Get your personal website + domain for just $100.

Limited Time Offer!

Claim Your Website Now

Drupal Troubleshooting Guide

1. Watchdog Database Logs

Drupal logs errors in the database using the Watchdog module, which is enabled by default. If you have access to the database via a tool like phpMyAdmin or command line access via MySQL client, you can query the Watchdog table directly.

To see the most recent log messages, you can run the following SQL query:

SELECT * FROM watchdog ORDER BY wid DESC LIMIT 50;

This query selects the last 50 entries in the Watchdog table. The message and variables columns will contain error information, though the variables column is serialized and may need to be unserialized to be human-readable.

2. PHP Error Logs

Since you’re using XAMPP, PHP’s error logs are another valuable resource for diagnosing an HTTP 500 error. By default, PHP errors might be logged to a file named php_error_log in the php directory within your XAMPP installation (/opt/lampp/logs/). This location can vary based on your PHP configuration (php.ini), where the error_log directive is set.

Open this log file with a text editor or use the tail command to view the last few entries:

tail -n 100 /opt/lampp/logs/php_error_log

This command displays the last 100 lines of the log file, where you might find errors related to your issue.

3. Apache Error Logs

Apache also logs errors, and these logs can provide details on what’s causing the 500 Internal Server Error. For a XAMPP installation, Apache’s error logs are typically located at /opt/lampp/logs/error_log.

You can view the most recent entries with:

tail -n 100 /opt/lampp/logs/error_log

Look for entries that correspond to the time the error occurred; they might give you specifics about what went wrong.

4. Enable Verbose PHP Error Reporting Temporarily

If the logs are not showing enough detail, you can temporarily increase the verbosity of PHP error reporting by modifying the php.ini file (/opt/lampp/etc/php.ini) and setting:

display_errors = On error_reporting = E_ALL log_errors = On

Remember to restart Apache after making these changes for them to take effect. This might provide more detailed errors directly in your browser or in the PHP error log.

5. Drupal’s settings.php

Lastly, ensure Drupal’s settings.php is configured to log errors by checking these settings:

$conf['error_level'] = 2; // Show all messages on your site

ini_set('display_errors', TRUE);

ini_set('display_startup_errors', TRUE);

This is particularly useful during development but should be used with caution on live sites.

By checking these logs and settings, you should be able to identify the cause of the HTTP ERROR 500 on your Drupal site.

6. Debugging Drupal:

  • Enable Drupal debugging: You can enable error reporting in Drupal by editing the sites/default/settings.php file and adding or updating these lines:
  • $config['system.logging']['error_level'] = 'verbose'; // Drupal 8 and later This might allow Drupal to display more detailed error messages on the screen or in its own logs.

7. How to enable verbose mode in Drupal

ou can temporary activate display of all errors by adding the next lines in your sites/default/settings.php file:

// Show all errors.
$config['system.logging']['error_level'] = 'verbose';
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

8. Manually Clear Cache

If Drush remains unresponsive and you need to clear your Drupal cache, you can do so manually through the database. This method requires access to your database via a tool like phpMyAdmin or command line.

  • Using MySQL Command Line:
    1. Log in to your MySQL database: mysql -u yourusername -p yourdatabase
    2. Run the following SQL command to clear the cache tables: DELETE FROM cache; Repeat this command for other cache tables (cache_render, cache_data, etc.), as needed.
  • Using phpMyAdmin:
    1. Open phpMyAdmin and select your Drupal database.
    2. Browse each cache table (cache, cache_render, cache_data, etc.).
    3. Use the “Empty” (or “Truncate”) option to clear the cache from each table.

Related Posts

Drupal Tutorails: Drush Complete Guide

Drush (Drupal Shell) is a command-line shell and scripting interface for Drupal. It provides a suite of commands for managing your Drupal sites, making tasks like module…

Read More

Step-by-step tutorial on how to upgrade from Drupal 7 to Drupal 10

here is a step-by-step tutorial on how to upgrade from Drupal 7 to Drupal 10, considering that Drupal 7 is on Server 1 and Drupal 10 will…

Read More

Drupal Tutorials: directory structure and Its Use Cases

The sites directory in a Drupal installation plays a crucial role in managing site-specific configurations, files, modules, themes, and other resources. It is designed to support multisite…

Read More

Drupal Guide: Directory Structure of Drupal

Directory Structure of Drupal 7 Explanation of Installed Files and Directories Root Directory Core Directories Sites Directory The sites/ directory is where all site-specific files and configurations…

Read More

All Drupal Release and its PHP version support

Drupal Version and PHP Compatibility Drupal Version Minimum PHP Version Maximum PHP Version Drupal 10 8.1 8.2 Drupal 9.4+ 8.0.2 8.1 Drupal 9.3.x 8.0.2 8.0 Drupal 9.2.x…

Read More

How to Install Drupal in Linux using Xampp

Drupal is a powerful and flexible open-source content management system (CMS) that powers websites and applications. It’s known for its scalability, security, and extensive community support. Here…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x