The 15 most common Drupal problems and solutions
Drupal is an enterprise-level content management system known for its flexibility and power. But with that power come challenges. In this article, we cover the 15 most common Drupal problems and how to solve them.
1. White Screen of Death (WSOD)
The dreaded white screen without any error message.
Causes
- PHP memory limit
- Fatal PHP error
- Corrupt module
- Database connection problem
Solution
Enable error reporting:
Add to sites/default/settings.php:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$config['system.logging']['error_level'] = 'verbose';
Increase PHP memory:
ini_set('memory_limit', '512M');
Via Drush (if available):
drush watchdog:show --count=50
2. "The website encountered an unexpected error"
Generic error page in Drupal 8/9/10.
Solution
View the logs:
drush watchdog:show
# or
tail -f /path/to/drupal/sites/default/files/logs/drupal.log
Recent log in database:
SELECT * FROM watchdog ORDER BY wid DESC LIMIT 20;
3. Database connection errors
"PDOException" or "SQLSTATE" error messages.
Causes
- Wrong database credentials
- Database server not reachable
- Too many connections
- Corrupt tables
Solution
Check credentials in settings.php:
$databases['default']['default'] = [
'database' => 'drupal_db',
'username' => 'db_user',
'password' => 'db_password',
'host' => 'localhost',
'driver' => 'mysql',
'port' => 3306,
];
Repair database:
drush sql:query "REPAIR TABLE cache_default, cache_entity, cache_render;"
4. Cache problems
Changes are not visible or site behaves strangely.
Solution
Clear all cache:
drush cache:rebuild
# or shorter:
drush cr
Via interface (if accessible): Configuration → Performance → Clear all caches
Manually clear cache:
rm -rf sites/default/files/css/*
rm -rf sites/default/files/js/*
5. Module installation or update fails
Composer gives errors or module doesn't work.
Solution
Increase Composer memory:
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/module_name
Update dependencies:
composer update --with-dependencies
Check module status:
drush pm:list --status=enabled
6. File upload problems
Media or files upload fails.
Solution
Adjust PHP settings:
upload_max_filesize = 64M
post_max_size = 64M
max_file_uploads = 20
File permissions:
chmod -R 775 sites/default/files
chown -R www-data:www-data sites/default/files
7. "Access denied" for content or admin
You unexpectedly cannot access certain pages.
Solution
Rebuild permissions cache:
drush php-eval 'node_access_rebuild();'
Restore User 1 rights:
drush user:login
8. Views don't load or give errors
Views module problems are common.
Solution
Cache specifically for Views:
drush views:invalidate --all
drush cr
9. Slow website performance
Drupal can become slow without good optimization.
Solution
Enable caching:
- Configuration → Performance
- Set "Page cache maximum age" to an hour or more
- Check "Aggregate CSS files" and "Aggregate JavaScript files"
Redis/Memcache:
composer require drupal/redis
drush pm:enable redis
10. Update hooks fail
drush updatedb gives errors.
Solution
Rerun specific update:
drush updatedb-status
drush updatedb
11. Configuration sync problems
Config import/export doesn't work correctly.
Solution
View config status:
drush config:status
Import specific config:
drush config:import --partial --source=/path/to/config
12. Theme/template problems
Frontend looks wrong or Twig errors.
Solution
Enable Twig debugging:
In sites/default/services.yml:
parameters:
twig.config:
debug: true
auto_reload: true
cache: false
13. Cron doesn't run
Scheduled tasks are not executed.
Solution
Run cron manually:
drush cron
Server crontab:
0 * * * * cd /path/to/drupal && drush cron
14. SSL/HTTPS mixed content
Insecure content warnings after SSL activation.
Solution
Force base URL:
In settings.php:
$settings['trusted_host_patterns'] = [
'^yoursite\.com$',
'^www\.yoursite\.com$',
];
$base_url = 'https://yoursite.com';
15. Memory exhausted errors
"Allowed memory size exhausted" error message.
Solution
Increase PHP memory:
In settings.php:
ini_set('memory_limit', '512M');
Useful Drush commands
# Status overview
drush status
# Database backup
drush sql:dump > backup.sql
# Module status
drush pm:list
# View updates
drush pm:security
# Watchdog logs
drush watchdog:show --count=20
Related articles
Need help?
Can't figure it out? Our support team is here for you! Submit a ticket through the customer portal and we'll usually help you within a few hours.
0 van 0 vonden dit nuttig