Slow site troubleshooting

From DreamHost
Jump to: navigation, search
This article is a work in progress. Some information is not complete. Proceed with caution!


What to do if your site is running very slowly, is not loading at all, or shows a 500 error or Internal Server Error.

Most sites that show errors or run slowly are database-driven sites. Their content is not saved on the web server (unless you have caching enabled for that web application), so it is dynamically created for each visitor by the communication between the web server and the database server.

There are a few common things that can go wrong and cause you to see errors.

Check version of PHP

Most Dreamhost customers are now on PHP5. However, if your site is a few years old, you might still be running it under PHP4.

PHP4 is no longer being updated and is no longer supported by the developers. (The final update on PHP4 was 7 August 2008.)

With the recent updates of the MySQL servers to 5.1, PHP 4 is not longer being supported. I highly recommend that everyone updates the version of PHP to PHP5. You can do this easily through our panel:

  1. Go to Manage Domains
  2. Click on "Edit" under "Web Hosting" for your domain.
  3. Go down to "Web Options". If your site is still running PHP4, it will read "PHP 4 CGI (not recommended)" in the drop-down menu next to "PHP mode:"
  4. To change it to PHP5, select "PHP 5 FastCGI (recommended)" from that menu, then click on "Change settings".

Check version of installed software

Web applications (like WordPress, Joomla, MediaWiki, and the like) are updated on a semi-regular basis, both to improve the application itself, and to block any security issues found in a previous version. For best performance, make sure that your installs are updated on a regular basis.

If you have installed software through Dreamhost's One-Click Installer, then updating is easy. If you have done Easy Installs, then the updating is automatic -- we handle it for you. If you have installed software using our Advanced One-Click panel, you have the option to update through that panel or to set it to update automatically.

One Click Panel
To see what the Advanced One-Click panel looks like, click on this image.

To check to see if your installs are the latest version, go to Dreamhost's One-Click Installer.

  1. Click on "Upgrade or remove previously installed software - Advanced mode".
  2. In the panel that opens, look for your site name, and then check under the far right-hand side column under "Actions". If it says "Already" and a version number, then you are all set, you are running the latest version. If it says "Upgrade to" and a version number, then that particular software package has a more recent version.
  3. Click on the "Upgrade to" button to upgrade your software to the latest version.
  4. Under the column "Upgrade Action", for each particular install, you can elect to have us contact you with the information that there is a new version, upgrade it automatically and let you know it has been upgraded, upgrade it automatically and not alert you, or do nothing and let you handle your upgrades manually.

If you have software manually installed, you are responsible for making sure it is upgraded on a regular basis. You can check the web page for the individual software install to see how to upgrade it yourself.

Private Servers

Many of the suggestions on this page can apply to private servers, but also check the Private Server Optimization for VPS-specific suggestions.

Site not found in configuration file

If you get an error on your site that reads:

Site Temporarily Unavailable
We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.

error id: "bad_httpd_conf" 

Then the problem is that your browser cannot find the site in the Apache configuration file. There are a few reasons for this.

  1. Sometimes the Apache configuration needs to be refreshed to include your site. You can refresh it yourself by following the steps in our Bad_httpd_conf article.
  2. If you have the nameservers for your domain pointed elsewhere, and have the specific site showing the Bad_httpd_conf error pointing to us using an A record, the IP address your site is on may have changed on our end. You can check for the correct IP address by going to the Manage Domains panel and clicking on the "DNS" link under the domain that is not functioning. At the bottom, under "Non-editable DNS records" look for the blank, FTP or www record (they should all be the same IP). If the IP you have in your DNS records doesn't match the IP listed there, update your DNS records to point to the IP address you found in the panel.

500 Error / Internal Server Error

Sites will sometimes attempt to load and then return a 500 error, or an Internal Server Error. In practical terms, that error means "Something went wrong, and we can't load the site," which isn't terribly helpful. Here are a few steps on how to track down exactly what those errors are and how to fix them.

How to check the error.log for your domain

Most of the time, a 500 error will leave a line in your error.log to indicate what exactly went wrong. You can access your error.log using shell or SFTP/FTP.

Shell

  1. Login to a shell on your server using SSH.
  2. Move to the directory that contains your error.log.
  3. View the file error.log with the text viewing program of your choosing, such as "more" or "less". (use man more, or man less for instructions on the use of these commands).

To move to the directory that contains your error log, type:

cd logs/yourdomain.com/http 

(replace "yourdomain.com" with your domain name without the www).

FTP

Manage Domains Panel
Click here to see where the WebFTP link is in our Manage Domains panel

You can check your error.log in an FTP program. The following instructions relate specifically to our WebFTP resource, but you can use a FTP client on your own computer as well.

  1. Login to FTP. To use WebFTP, go to Manage Domains and click on "WebFTP" under the domain in question.
  2. Once you are in WebFTP, find the white field that has your domain directory name in it. It should be just above the text reading "root/yourdomain.com".
    WebFTP Panel
    Click here to see what the WebFTP panel looks like
  3. In that field, type "logs/yourdomain.com".
  4. Then click on "http" or "http.123456" (or whatever random numbers follow the http name).
  5. On that page, click on "View" to the far right under "Actions" for the file error.log.

You can also just move to the root directory for your user, and navigate to logs/yourdomain.com/http.

That will let you see your error.log so you can find out exactly what errors your site has registered.

Specific Errors from the error.log

“Premature end of script header”

  • Inefficient processes
Inefficient database

If your database has "overhead" (unused empty space), it can cause queries to the database to take longer, and may result in the web server timing out before it can receive the response from the database server.
You can optimize your database by logging into phpMyAdmin through the MySQL Databases link in the panel.
Once you are in phpMyAdmin:

  1. Select the database you want to optimize in the left-hand column
  2. In the main menu screen, scroll down to nearly the bottom and click on "Check tables having overhead" (if this option is not showing, then none of your tables have overhead)
  3. In the drop-down box next to the "Check tables having overhead" link, select "Optimize".

  • Too many concurrent processes
    • Too many open FTP connections

Syntax error in .htaccess

Over-browsing by specific IPs

  • You can find instructions on how to check which IPs have viewed your site recently by checking our Finding Causes of Heavy Usage article.
  • Usually, if there is one or a few IPs that represent 10% or more of your site's visits (1000 or more visits out of the last 10,000), checking the IP shows that they are search engine bots like Google, Yahoo or others. These bots are not responsible for your site's ranking. They skim your site to see if brief text quote accompanying your site's listing when someone searches for it needs to be updated. Occasionally, they can try to browse your site hundreds of times a day, preventing actual visitors from reaching you. To slow or block search engine bots, please check our Bots, Spiders, and Crawlers article.

WordPress Optimization

Joomla Optimization

phpBB Optimization

Drupal Optimization

Traceroute

If all else fails, check the connection between your computer and our servers by running a traceroute.