Troubleshooting a single site's connection


This article lists common errors you may see on your website along with troubleshooting solutions to resolve the issues you're seeing.

In a shared hosting environment, there are many issues that can affect the performance of your site. They can range from problems with your database, compromised code, misconfigurations in your site, and hitting memory limits which causes your processes to be killed.

To make matters worse, these problems can often cause each other. For example, a compromised site could slow down the database with junk data, causing it to take more time and memory to load, which then causes the user for the site to hit memory limits.

Troubleshooting a single site

Immediate 500 Internal Server Error

There are two things that can potentially cause this to happen.

  • .htaccess issues
  • Hitting Shared server memory limits

.htaccess issues

If the error happens instantaneously, then most likely the cause is something to do with your site's .htaccess file. Some potential things to look for:

  • Syntax errors in the .htaccess file
  • Custom PHP setup that isn't working

To see if this is the cause, try renaming the .htaccess file in your site's home directory to something like ".htaccess.disabled". If the problem is in your .htaccess file, that will immediately solve the problem.

Keep in mind that .htaccess rules apply to all subdirectories – so it's possible for an .htaccess file outside of your site's web directory to affect your site. Make sure you also look higher up in the directory structure for .htaccess files that might affect things and try renaming any you find in order to see if it helps.

Hitting memory limits

If that doesn’t solve the problem, you may be having processes killed due to exceeding your user's memory limit. One quick way to see if this might be affecting you is to simply check to see which processes you have running as your user. The following articles list several tools you can use to investigate your running processes and memory usage:

Site spins trying to load for a while and then displays a 500 Internal Server Error

This can be caused by a few different things.

  • Hitting memory limits as described above
  • PHP timing out

PHP timing out

If this only happens on specific pages (in particular admin pages for the software you're using), then it's very likely that this could be the cause. By default, the PHP timeout is 30 seconds. You can find out if this is the cause by creating a custom phprc for your site and adjusting the max_execution_time setting to 2-3 times what it is now.

If this happens to all of your pages, then it can still potentially be a PHP timeout. You can check your site error logs to see if there are any helpful error messages. If all you see is a "Premature end of headers" error, there isn't much information to troubleshoot with as this simply means the script exited before completing.

You can read more about creating a custom phprc file in the following article:

Site tries to load then displays a 522 connection timed out error

The 522 connection timed out error only appears on Cloudflare-enabled domains when Cloudflare times out contacting the origin web server. See the following article for information on how to troubleshoot a 522 error:

Site spins while loading forever

This is perhaps the most generic thing that can happen with your site. Most often this means that something is causing your PHP processes to hang. If you run the top -c command on the server you might notice <defunct> showing up next to some of those processes as well. This can be caused by a large number of things.

With WordPress, this often has to do with database tables having overhead. That shouldn't cause problems, but for some reason WordPress can get itself into a bad state if there is any overhead (particularly in the wp_options table) and it will oftentimes exhibit this symptom in those cases. Other major causes of this are software misconfigurations or third-party addons to the software you're using that have a compatibility issue or poor coding.

You can read more about reducing overhead and optimizing WordPress in the following articles:

Site loads immediately, but only a blank page displays

This issue is most often related to either a WordPress theme that's being used having problems or a caching plugin behaving improperly. Depending upon what exactly is going on this one can be a little tricky to solve and will likely require some fiddling to get things working properly again.

Site loads immediately, but displays a database connection error

View the following article for information on how to troubleshoot a database connection error:

Site loads immediately, but displays a 403 Forbidden Error

The 403 Forbidden error is displayed when a deny rule is set for an IP in a site's .htaccess file or when file permissions keep the web server from serving up a page. You can usually get an idea of the issue causing this by looking at your error.log file:

In most cases this is file-permission related. To check permissions for your site:

  1. Log in via SSH.
  2. Get a directory listing by running the ls -la command:
[server]$ ls -la
drwxr-x--x   16 youruser pg123456    4096 2009-12-10 04:25 ./

The first line should look like the above. Notice the permission string that reads "drwxr-x--x". The first letter stands for "directory", then there are three sets of three permissions. The first set are the owner permissions, which are set to read/write/execute. The second set are the group permissions which are set to read/execute. The third set are "other" permissions (or what all other users have), which is set to execute only. If you have Enhanced Security enabled for your user it would look like this instead:

[server]$ ls -la
drwxr-x---   16 youruser  adm    4096 2009-12-10 04:25 ./

The above are correct permission settings. If instead they look like this:

drw-r-----   16 youruser pg123456    4096 2009-12-10 04:25 ./

or this:

d---------   16 youruser pg123456    4096 2009-12-10 04:25 ./

Then that means your user has been disabled and you should contact DreamHost. If this is the case you'll likely see errors like this when attempting to log in and won't be able to get the directory listing as described above:

Could not chdir to home directory /home/youruser: Permission denied
-bash: /home/youruser/.bash_profile: Permission denied

If you see this, contact DreamHost support for assistance.

If permissions look fine, but you're still getting a 403 error, then try renaming the .htaccess file for your affected domain from ".htaccess" to ".htaccess.disabled" like this:

[server]$ mv .htaccess .htaccess.disabled

Then, try loading up your site. If the 403 error is gone, then open up your .htaccess file and look for lines starting with "deny". If you find any, comment them out by putting a "#" before the line and saving the file. You can re-enable the .htaccess file you disabled above like this:

[server]$ mv .htaccess.disabled .htaccess

If you see the site directory has an addition to the end of its directory saying that it was disabled by DreamHost, check your email for a notice from support concerning why. If you cannot find one, write in for support immediately.

Visit the following page for further details on file permissions:

Site loads, but displays a 404 Error rather than what you expected

This happens most often with sites that use software such as WordPress that use .htaccess rules for their permalinks/pretty URLs. If those rules are removed or changed somehow then a 404 will appear rather than the content you expect.

The easiest way to fix this is to download a fresh copy of the software you're using from its website (e.g., and then copy the contents of the default .htaccess file and paste it into your existing one (keep in mind that ".htaccess" files are invisible files, so you might need to enable viewing of invisible files in your FTP client to find the file if it's there).

Not all software comes with an .htaccess file by default. For instance, WordPress generates one when you change your permalinks settings, so keep that in mind as well. If putting in the default .htaccess rules doesn't resolve the 404 issue, write in to support and request additional help.

For WordPress specifically, this can often be fixed by just resaving your permalink structure. To do this, log into your admin panel, go to ‘Settings' > 'Permalinks’, and then click the save permalinks button.

Note on new WordPress installs

This issue can appear on new WordPress setups when you attempt to view the site after changing it over from another hosting option (such as mirroring or redirection). In these cases, the site is still resolving to the old Mirror or Redirection A records, rather than the new 'Fully Hosted' A records. Fortunately, this will resolve once DNS propagation completes, assuming that the site is using DreamHost’s nameservers. See the following article for further information on DNS propagation:


Did this article answer your questions?

Article last updated PST.