Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
108 views

How To Fix HTTP Error Code

This document provides instructions for troubleshooting and resolving an HTTP 500 internal server error. Some potential causes and solutions include: refreshing the page, checking server logs for errors, ensuring proper file permissions, and changing permissions using chmod if needed. The error typically indicates a problem on the server preventing the website from functioning properly.
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

How To Fix HTTP Error Code

This document provides instructions for troubleshooting and resolving an HTTP 500 internal server error. Some potential causes and solutions include: refreshing the page, checking server logs for errors, ensuring proper file permissions, and changing permissions using chmod if needed. The error typically indicates a problem on the server preventing the website from functioning properly.
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 3

How to Fix HTTP error code “500 internal

server error”
https://www.1and1.com/cloud-community/learn/web-server/server-
management/how-to-fix-http-error-code-500-internal-server-error/

Introduction
Learn how to fix the HTTP error code “500 internal server error.” This error means there is a
problem on the server side. It is an all-purpose error, which means a serious problem is
preventing your website from functioning.

Refresh the Page


The first thing to do when you encounter this error is wait a moment and then refresh the
page. Sometimes this error is caused when a service restarts, and you happen to catch it at
exactly the wrong time. If the problem persists after you refresh the page, continue
troubleshooting.

Check Your Server Logs


Your first stop should be your website's error logs. On a Linux server, the default location for

the main website error log is /var/log/httpd/error_log .

If you have multiple websites hosted on your server, they will likely have their own error logs.
The location of these log files will be specified in the site's Apache configurations. Typically

these are located in the website's /logs/ directory.

If the error log is large, it can be difficult to find the correct line. If you know that a particular
script is causing the error, you can search the file for this script name by using the command:

more /var/log/httpd/error_log | grep [file name]

This will return any lines which have the file name in them.
If you are not sure what is causing the error, you can follow the error log in one window and
watch it being generated. First, in your SSH session, use the command:
tail -f /var/log/httpd/error_log

Without closing the SSH session, go to a web browser and refresh the page to generate the
500 error again. You should see the error appear in the log file.
You can also view the last 10 lines in the error log with the command:
tail -20 /var/log/httpd/error_log

Once you find the error, copying and pasting it into Google will often yield helpful results.

Check Permissions
An HTTP 500 error can be caused by a permissions problem with your website’s files or
folders. Check the permissions on all of your main folders and scripts. Most Perl and CGI files

need to have their permissions set to 755 .

To check the permissions of files on a Linux system, connect via SSH to your server and go to

the directory where the files are kept. Use the 11 command to list all files and file details.

The first block of letters lists the file's permissions. There are three permission levels:
•Read (r)
•Write (w)
•Execute (x)
The permissions are shown in groups of three:
•Group 1: Owner
•Group 2: Group
•Group 3: World (everyone)
In the above example, the first file ( test.cgi ) has read/write/execute permissions for the
owner, but only read/write permissions for group and world (755).

The second file ( test.py ) has read/write/execute permissions for owner, group, and world
(777).

Changing Permissions
To change the permissions for a file, you need to use the chmod command, along with the
numerical value of the permissions level you want to set. The most common permissions
levels are:
•7: Read, write, and execute (rwx)
•5: Read and execute (r-x)
•0: None (---)

Most scripts will require read/write/execute permissions for the owner, and read/execute
permissions for group and world. To set this on a file, use the command:

chmod 755 [filename]

If you are still receiving an error when you run your script, try setting it to global
read/write/execute permissions for testing purposes. To set this on a file, use the command:

chmod 777 [filename]

This permissions level can be risky, because it allows anyone to rewrite your file. Once you
have finished troubleshooting, be sure to set the file back to the correct permissions.
Now set appropriate permissions for the WordPress directory.

chown -R www-data:www-data /var/www/html/wordpress


chmod -R 755 /var/www/html/wordpress

You might also like