
A blank white page showing 500, 403, or 404 means something has gone wrong. Each error code has a different meaning and a different fix. This guide breaks down the most common HTTP errors on shared web hosting, explains the causes, and shows you how to read the error log in DirectAdmin to find the real root cause.
1. What Are HTTP Error Codes?
HTTP status codes are response codes the web server sends to the browser. Codes starting with 4xx indicate a client-side error; 5xx codes indicate a server-side problem.
- 403 Forbidden — Server understood the request but refuses to fulfil it
- 404 Not Found — The requested resource does not exist
- 500 Internal Server Error — The server encountered an unexpected condition
- 502 Bad Gateway — Upstream server returned an invalid response
- 508 Resource Limit Reached — CPU/RAM quota exceeded (DirectAdmin specific)
2. Error 500 — Internal Server Error
Error 500 is the most common and least descriptive error. The server knows something went wrong but does not show you what. You must check the error log to find the real cause.
Common Causes
- Broken .htaccess — Syntax error or unsupported directive
- PHP memory limit exceeded — Script needs more RAM than the hosting plan allows
- PHP execution timeout — Script runs longer than
max_execution_time - PHP syntax error — A bug in your PHP code
- Wrong file permissions — PHP file set to 777 or owned by wrong user
Fix a Broken .htaccess
Rename .htaccess to .htaccess.bak and reload the page. If the error disappears, .htaccess was the culprit. Re-enable it line by line to find the bad directive.
Fix PHP Memory and Timeout
Add these lines to your .htaccess file:
php_value memory_limit 256M php_value max_execution_time 300 php_value post_max_size 64M php_value upload_max_filesize 64M
WordPress: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php to raise the memory limit specifically for WordPress.
3. Error 403 — Forbidden
Error 403 means the server knows what you are requesting but will not let you access it. Common reasons:
- Wrong file/directory permissions — files must be 644, directories must be 755
- No index file — no index.html or index.php in the folder with directory listing disabled
- .htaccess deny rule — an IP block rule in .htaccess is matching your IP
- Imunify360 block — the security system detected unusual behaviour
Fix File Permissions
In DirectAdmin → File Manager → select file → Change Permissions, or via SSH:
# Files should be 644 chmod 644 filename.php # Directories should be 755 chmod 755 /public_html/dirname # Recursive fix for all files and directories find /public_html -type f -exec chmod 644 {} \; find /public_html -type d -exec chmod 755 {} \;
4. Error 404 — Not Found
Error 404 means the server cannot find the requested resource. Common causes:
- File was deleted or renamed, but the URL still points to the old path
- WordPress permalinks need to be flushed after a migration
- RewriteRule in .htaccess has a typo or logic error
- Internal links were not updated after moving to a new domain or folder
WordPress: Flush Permalinks
Go to Settings → Permalinks → click "Save Changes" without changing anything. This regenerates the .htaccess rewrite rules WordPress needs for clean URLs.
Add Custom Error Pages
Add these lines to .htaccess to redirect error codes to friendly pages:
ErrorDocument 404 /404.html ErrorDocument 403 /403.html ErrorDocument 500 /500.html
5. How to Check Error Logs in DirectAdmin
The error log is the most powerful debugging tool available on shared hosting. It shows the actual error messages generated by PHP and Apache.
Opening the Error Log
- Log in to DirectAdmin.
- Go to Advanced Features → Site Summary / Statistics / Logs.
- Click Error Log or the file named error_log.
Examples of error log entries:
[Mon May 12 10:23:45 2026] [error] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted in /home/user/domains/example.com/public_html/wp-load.php on line 456 [Mon May 12 11:05:12 2026] [error] PHP Parse error: syntax error, unexpected '}' in /home/user/domains/example.com/public_html/functions.php on line 89
6. Error 502 and 508 — Bad Gateway and Resource Limits
Beyond 500, 403, and 404, two more error codes appear frequently on shared hosting — especially when a site receives sudden traffic spikes or runs heavy scripts.
502 Bad Gateway
Error 502 means a gateway or proxy server received an invalid response from an upstream server. On shared hosting the most common causes are:
- PHP-FPM crash — the PHP process died and the server is restarting it
- Server overload — too many concurrent requests; the server cannot respond in time
- Script timeout at the network level — PHP execution timed out before the response was sent
A 502 often resolves on its own within 30–60 seconds. If it keeps occurring, check the error log and consider optimising your heaviest PHP scripts or contacting support to review server health.
508 Resource Limit Reached
Error 508 is used by DirectAdmin (and some cPanel/LiteSpeed environments) to signal that your account has exceeded its CPU, RAM, or I/O quota assigned to your hosting plan.
- Check usage in DirectAdmin → Account Manager → Resource Usage
- Identify heavy PHP files via the error log — WordPress plugins and unindexed database queries are frequent culprits
- Add a caching layer (W3 Total Cache, LiteSpeed Cache) to reduce repeated PHP execution
- If traffic has genuinely grown, upgrading your plan or moving to a VPS gives you dedicated resources
7. Preventing Errors Before They Happen — Best Practices
Fixing errors quickly matters, but preventing them from occurring in the first place matters more. The following practices significantly reduce the frequency of HTTP errors on shared hosting.
Log Errors Instead of Displaying Them
Never display PHP errors on a production site — it leaks internal paths and logic to visitors. Write errors to a log file instead:
# Add to .htaccess
php_flag display_errors off
php_flag log_errors on
php_value error_log /home/USER/error_php.logValidate .htaccess Before Uploading
Syntax errors in .htaccess are the leading cause of Error 500 on shared hosting. Test the file before deploying:
# On Linux/Mac with Apache installed apachectl -t # Or use an online validator: # https://htaccess.madewithlove.com/
Fix Permissions Right After Uploading Files
Files uploaded via FTP often land with incorrect permissions. Check and correct them immediately after upload:
# Find files with dangerous permissions find /public_html -type f -perm 777 find /public_html -type f -perm 000 # Bulk fix all files and directories find /public_html -type f -exec chmod 644 {} \; find /public_html -type d -exec chmod 755 {} \;
Create Custom Error Pages for Better UX
When an error does occur, users should see a helpful page rather than a blank screen. Custom error pages can guide visitors back to working content:
ErrorDocument 400 /errors/400.html ErrorDocument 403 /errors/403.html ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html
WordPress tip: Use a plugin such as "404page" or "Custom 404 Pro" to set a branded error page without editing files manually.
8. Debugging Tools Inside DirectAdmin
DirectAdmin includes several built-in tools that let you investigate errors without SSH access. Knowing where to look saves significant troubleshooting time.
| Tool | Location in DirectAdmin | Best For |
|---|---|---|
| Error Log | Advanced → Site Summary / Logs | Error 500, PHP Fatal, Parse errors |
| Access Log | Advanced → Site Summary / Logs | See which URLs are erroring and from which IPs |
| Resource Usage | Account Manager → Resource Usage | Error 508, CPU and RAM spikes |
| File Manager | Advanced → File Manager | Fix permissions, edit .htaccess directly |
| PHP Settings | Advanced → PHP Config | Change memory limit, execution timeout |
Reading the Error Log Efficiently
Error logs can grow large quickly. Use these commands to filter only the entries you need:
# Show only PHP Fatal errors grep -i "Fatal error" error_log | tail -20 # Show errors from the last hour grep "$(date +'%b %d %H')" error_log | grep -i error | tail -50 # Find files generating the most errors grep -i "error" error_log | grep -oP 'in /[^ ]+' | sort | uniq -c | sort -rn | head -10
9. Error Summary Table
| Code | Name | Common Cause | Quick Fix |
|---|---|---|---|
| 500 | Internal Server Error | Bad .htaccess / PHP error / memory exceeded | Rename .htaccess / check error log |
| 403 | Forbidden | Wrong permissions / no index file | chmod 755/644 / create index.html |
| 404 | Not Found | File deleted / wrong permalink | Flush permalink / check URL |
| 502 | Bad Gateway | PHP-FPM crash / server overload | Contact support |
| 508 | Resource Limit | CPU/RAM quota exceeded | Optimize code / upgrade plan |
Stable Hosting with 99% Uptime and 24/7 Support
AsiaGB Hosting starts at 500 THB/year with DirectAdmin, error logs, PHP 7.4/8.2/8.3, and SSD storage. Our support team can help you diagnose and fix any hosting error.
View Hosting Plans