3.4 KiB
3.4 KiB
WordPress
Table of Contents
Documentation
Common WordPress Errors
- HTTP Errors
- 404 Not Found: Page or resource missing.
- 403 Forbidden: Insufficient permissions to access the resource.
- 500 Internal Server Error: Generic error, often caused by server misconfiguration or PHP errors.
- 503 Service Unavailable: Server is overloaded or in maintenance mode.
- Database Errors
- Error Establishing a Database Connection: Database credentials incorrect or database server is down.
- Table Prefix Issues: Wrong
$table_prefixinwp-config.php. - Corrupt Database: Can be fixed using
wp db repair.
- PHP Errors
- Parse Error: Syntax error in PHP files.
- Fatal Error: Missing function or class.
- Deprecated Function Warnings: Old functions being used.
Debugging Steps
- Enable Debug Mode
Edit wp-config.php:
// Enable Debug Mode
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of WordPress errors and warnings
define('WP_DEBUG_DISPLAY', false);
// Disable display of PHP errors and warnings
@ini_set('display_errors', 0);
Logs will be saved in wp-content/debug.log.
- Check
.htaccess
Ensure WordPress rules exist:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
- Check Apache and VirtualHost config
Redhat and derivatives
/etc/httpd/conf/httpd.conf/etc/httpd/conf.d/welcome.conf
Debian and derivatives
/etc/apache2/apache2.conf/etc/apache2/sites-available/000-default.conf
<Directory "/var/www">
AllowOverride All
# Allow open access:
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
- Reset File Permissions
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 644 {} \;
- Disable Plugins & Themes
Hide the plugin directory:
mv wp-content/plugins wp-content/.plugins
Switch to a default theme:
wp theme install twentytwentyfive --activate
wp theme activate twentytwentyfive
- Check Server Logs
For Apache:
tail -f /var/log/httpd/error_log
For Nginx:
tail -f /var/log/nginx/error.log
- Verify Database Connection
wp db check
If corrupt:
wp db repair
- Increase Memory Limit
Edit wp-config.php:
define('WP_MEMORY_LIMIT', '256M');
Debugging Tools
- WP-CLI: Command-line interface for WordPress.
- Query Monitor: Plugin for analyzing database queries and errors.
- Health Check & Troubleshooting: Plugin for diagnosing issues.