Fixing Magento Issues: White Screen and 500 Errors
Magento problems such as white screen and 500 errors can be frustrating. In this guide, we help you solve the most common issues.
First Steps in Troubleshooting
Before you start troubleshooting:
- Check the error logs
- Enable development mode (temporarily)
- Check recent changes - what has changed?
- Make a backup before making any changes
Enabling Developer Mode
To see detailed error messages:
bin/magento deploy:mode:set developer
Note: Disable this after troubleshooting for better performance.
Resolving White Screen
A white screen (White Screen of Death) indicates a fatal PHP error.
Step 1: Check Error Logs
# Magento error log
tail -100 var/log/exception.log
PHP error log
tail -100 /path/to/logs/error.log
Apache error log
tail -100 /var/log/apache2/error.log
Step 2: Show PHP Errors
Temporarily add to index.php:
ini_set('display_errors', 1);
error_reporting(E_ALL);
Step 3: Common Causes
Memory limit
# Check current limit
php -i | grep memory_limit
Increase via .htaccess
php_value memory_limit 2G
Corrupted cache
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/*
Permissions
find var generated pub/static pub/media -type d -exec chmod 755 {} \;
find var generated pub/static pub/media -type f -exec chmod 644 {} \;
500 Internal Server Error
Step 1: Check .htaccess
A corrupted .htaccess is a common cause:
- Rename
.htaccessto.htaccess_backup - Download a fresh
.htaccessfrom Magento GitHub - Test the website
Step 2: PHP Version
Check if the PHP version is compatible:
- Magento 2.4.6+: PHP 8.1 or 8.2
- Magento 2.4.4-5: PHP 8.1
Step 3: Database Connection
Test the database connection:
- Check credentials in
app/etc/env.php - Test connection via phpMyAdmin
- Check if the database server is running
Step 4: DI Compilation
rm -rf generated/*
bin/magento setup:di:compile
Cache Issues
Clear All Cache
bin/magento cache:clean
bin/magento cache:flush
Specific Cache
# Only configuration cache
bin/magento cache:clean config
Only full page cache
bin/magento cache:clean full_page
Manual Cache Removal
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/view_preprocessed/*
rm -rf pub/static/frontend/*
rm -rf pub/static/adminhtml/*
rm -rf generated/*
Index Issues
Check Index Status
bin/magento indexer:status
Rebuild All Indexes
bin/magento indexer:reindex
Specific Index
bin/magento indexer:reindex catalog_product_price
bin/magento indexer:reindex catalogsearch_fulltext
Admin Panel Issues
Admin Not Loading
- Check admin URL
bin/magento info:adminuri - Reset admin URL
bin/magento config:set admin/url/use_custom 0 bin/magento config:set admin/url/use_custom_path 0 - Clear cache
bin/magento cache:clean
Cannot Log In
- Reset admin password:
bin/magento admin:user:unlock adminusername bin/magento admin:user:change-password adminusername newpassword - Check account status in the database (admin_user table)
Extension Issues
Finding Problematic Extension
# Disable all extensions
bin/magento module:disable --all
Re-enable core modules
bin/magento module:enable Magento_Backend Magento_Store ...
Test website
Enable extensions one by one
bin/magento module:enable Vendor_Module
Emergency Extension Removal
If CLI does not work:
- Go to phpMyAdmin
- Find
setup_moduletable - Delete the problematic module entry
- Manually clear var/cache
Database Issues
Repair Database
# Via Magento CLI
bin/magento setup:db:status
bin/magento setup:db-schema:upgrade
bin/magento setup:db-data:upgrade
Repair Tables via phpMyAdmin
- Select all tables
- Choose "Repair table" from dropdown
- Execute
Debugging Tips
Enable Profiler
bin/magento dev:profiler:enable
Then check Profiler output at the bottom of the page.
Query Logging
In app/etc/env.php:
'db' => [
'connection' => [
'default' => [
'profiler' => [
'class' => '\Magento\Framework\DB\Profiler',
'enabled' => true
]
]
]
]
XDebug
Configure XDebug for step-by-step debugging in your IDE.
When to Enable Support
Contact support if:
- You cannot find the cause
- It seems to be a server-level issue
- You need changes that require admin rights
- The problem keeps recurring
Related Articles
Need Help?
We are here for you! Are you facing any issues or have questions? Our support team is happy to assist you personally. Send us a message via the ticket system - we usually respond within a few hours and are happy to help.
0 van 0 vonden dit nuttig