Chapter 18 · 18.1
My website is blank or shows a 500 error
You open your website and see a blank screen, the message 500 Internal Server Error, HTTP ERROR 500 or, with WordPress, There has been a critical error on this website. This almost always means your website's code is crashing. The server itself is usually working fine. With the steps below, you can find the cause yourself in most cases.
First: what changed recently?
A 500 error almost never comes out of nowhere. Think back over the last few hours or days:
- Did you update a plugin, theme or WordPress itself, or did WordPress do this automatically?
- Did you change the PHP version?
- Did you change anything in the .htaccess file, or create a redirect or password-protected folder?
- Did you upload files or change file permissions?
If you know what it was, undo that exact change first. That's usually the quickest fix.
Step 1: check the error log
The error log tells you exactly which file and which line is causing the error. You'll find it in DirectAdmin under System Info & Files and then Site summary & logs. Choose your domain and open the error log. Look at the bottom lines: those are the most recent. You can read exactly how this works in Site summary & logs: the error log and the access log.
If you see, for example, PHP Fatal error with a path to wp-content/plugins/plugin-name, you immediately know which plugin is the culprit.
Step 2: the most common causes
Below are the causes, from most to least common.
1. A plugin or theme after an update
This is by far the most common cause with WordPress. If you can no longer access the WordPress admin, disable the plugins via DirectAdmin:
- Open File Manager (see Opening File Manager: the directories in your package).
- Go to domains/yourdomain.com/public_html/wp-content.
- Rename the plugins folder to, for example, plugins-off. WordPress will then disable all plugins.
- Does your site work again? Rename the folder back to plugins and switch the plugins on one by one in WordPress, until the error returns. Then you know which one it is.
If you already know which plugin it is (from the error log), just rename that plugin's folder. With a critical error, WordPress often also sends an email to the administrator address with a link to recovery mode. So check your mailbox too.
2. The PHP version doesn't match your website
An old website often doesn't work on a new PHP version, and a new plugin sometimes doesn't work on an old one. If you've just changed the PHP version, switch it back in Select PHP version (see Selecting the PHP version (Select PHP version)). In Fouten na een PHP-upgrade en het foutlog vinden you can read how to make your site compatible with a newer version afterwards.
Tip: Has your website not been updated for years and no longer works on a modern PHP version? We can update it for you. Visit www.weboke.nl/en/website-php-upgrade.
3. An error in .htaccess
One wrong line in .htaccess causes an immediate 500 error for the whole site. A well-known example is a line left behind by a security plugin, such as php_value auto_prepend_file with a path to a file that no longer exists (for example from Wordfence or All In One WP Security). Test it like this:
- Switch on hidden files in File Manager (see Showing and editing hidden files such as .htaccess).
- Rename .htaccess in public_html to .htaccess-old.
- If the site now works (possibly without clean URLs), the error is in that file. Remove the faulty line and rename the file back.
PHP settings such as the maximum upload size are easiest to set in Select PHP version (see PHP options: upload_max_filesize, memory_limit and max_execution_time). A line with php_value in .htaccess also works (see PHP settings per directory and via .htaccess).
4. Not enough memory for PHP
If the error log shows Allowed memory size of ... bytes exhausted, a script needs more memory than PHP is allowed to use. Increase memory_limit in the Select PHP version options (see PHP options: upload_max_filesize, memory_limit and max_execution_time).
5. Incorrect file permissions
If folders or files have overly broad permissions (such as 777), the server refuses to run them. Folders should be set to 755 and files to 644. You can read how to change this in File and directory permissions (chmod).
6. Your package's storage is full
If your package is full, your website can no longer write temporary files or sessions. Check Disk Space on the DirectAdmin dashboard. You can read what to do about this in Storage full: where's the space going?.
7. Less common: database, limits or a hack
- Do you see Error establishing a database connection? Read 'Error establishing a database connection'.
- Do you see a 503 or Resource Limit Is Reached? Then your package is hitting its processing power limit. Read 503 or 'Resource Limit Is Reached': what now?.
- Are there files you don't recognise, or does your site send visitors to strange websites? Read My website has been hacked: step-by-step plan.
A blank screen with no message
With a blank screen, PHP deliberately doesn't show the error message to visitors. The error log from step 1 is then your best source. With WordPress, you can also temporarily set define('WP_DEBUG', true); in wp-config.php. Set it back to false afterwards, otherwise visitors will see technical details about your site.
Other error codes in brief
| Message | What does it mean? | Where to read more |
|---|---|---|
| 403 Forbidden | The server refuses to show the page, for example because of your website's firewall, permissions or a missing index file. | Error 403 or 406 when saving or uploading |
| 404 Not Found | The page or file doesn't exist at that location. Is your website in public_html of the correct domain? Watch out for capital letters in file names. | Opening File Manager: the directories in your package |
| 413 Request Entity Too Large | What you're uploading is larger than allowed. | Upload too large (error 413) or timeout |
| 500 Internal Server Error | Your website's code is crashing. | This article |
| 503 or 508, Resource Limit Is Reached | Your package is temporarily using more processing power than allowed. | 503 or 'Resource Limit Is Reached': what now? |
| WebOké page instead of your site | The domain isn't (correctly) set up in your hosting package yet, or the DNS still points elsewhere. | My domain isn't working yet after a transfer or change |
Back to a working version
Can't figure it out, and did the site still work yesterday? Then restore a backup. In My WebOké, you can do this with WebOké Backups: choose a moment before the error and restore only your website's folder and, if needed, the database (see Can I also do this in My WebOké? WebOké Backups). If you use Installatron, you can also restore a backup from Installatron (see Making and restoring backups in Installatron).
Tip: With Domain health on www.weboke.nl/en/domein-gezondheid you can see at a glance whether your domain, the A record, the website and the SSL certificate are all in order. Under Website you'll then see, for example, Responds with a server error (HTTP 500).
