Why do I get 500 - Internal Server Error?

You receive a 500 error (generally)

Follow this guide to reading and interpreting logs using Plesk to learn the true cause of the error.

Some common causes:

0) Your PHP Settings in Plesk are set to Apache Module mode and the wp-config.php file (or other core file) does not have 'other' read permissions

Please do not change the permissions -- wp-config.php is intended to have limited permissions to ensure optimal security of your website. Instead, change the PHP run mode to either FPM or FastCGI.

1) You receive a 500 Internal Server error because you have a directive in .htaccess that is disallowed

The most common version of this is having FollowSymLinks in one or more .htaccess files. Check the logs, as shown above, to learn which .htaccess file has the directive, and comment it out by placing a # at the start of the line that contains FollowSymLinks (or +FollowSymLinks).

SymLinks are disabled in shared hosting environments as they are commonly used as a medium to attack other websites hosted on the server. If you have your own VPS, FollowSymLinks can be enabled.

2) You received the 500 error during a WordPress import, clone, or restore from backup

This is most often caused by a security plugin, like WordFence, attempting to load a particular file (like .user.ini) and failing to do so because the file hasn't yet been copied over or restored from backup. You should use the link above to find the actual log entry that corresponds with the error. it will show you which file is causing the problem so that you can rename it or remove it to get things working again. Here's an example of this in action:

mod_fcgid: stderr: PHP Fatal error: Unknown: Failed opening required '/home/username/domain.com/wordfence-waf.php' (include_path='.:/opt/plesk/php/7.0/share/pear') in Unknown on line 0

In this instance the hidden file called '.user.ini' found in the web root is attempting to load wordfence-waf.php from a non-existent location. Your best bet is to delete the .user.ini file or rename it to simply user.ini.bak to disable it. If you get a different filename/path, you probably just need to correct the path to solve the problem.

3) You receive a 500 error when working with Perl / CGI

If you follow these steps on our server you shouldn't have a problem:

A. IMPORTANT (Many people don't realize that the script is in binary mode!)
Make sure you upload scripts in ASCII mode, not binary. If your FTP program is set to "auto-detect," make sure that the file type (.cgi or .pl) of the script is on the list of ASCII file types.

B. Make sure that the path you are using for PERL in your cgi scripts is correct. The correct first line of your perl scripts should be: #!/usr/bin/perl
if you are using: #!/usr/bin/perl -w ; this is good for trouble shooting your code, but should be removed when you upload your files for public viewing. The -w option is to display warnings that your script outputs. If your script has warnings than you will get a 500 error everytime, since it's displaying the warnings first, causing the premature end of script headers.

C. Syntax errors, if the code is broken or incomplete than it will return a premature end of script headers (500 error).

Make sure the permissions and ownership on both the script, any files it may use, the cgi-bin directory, and any other directories inside it containing executed scripts are all correct. This is how the ownership should be:

The cgi-bin directory itself will have the ownership:
user: login_username
group: psaserv

The files and directories inside the cgi-bin directory will have the following:
user: login_username
group: psacln

This is how the permissions should be:
750 for the actual cgi-bin directory.

755 for files and directories(not containing other scripts) inside the cgi-bin (unless a custom script you're using requires specific permission set for a file)

750 for any directories inside the cgi-bin that contain used cgi scripts. (ie. if you have the directory "newspro" inside the cgi-bin directory with executed files in it, newspro should have 750 permissions.)

To change all folder at the current level and within in one command: find . -type d -exec chmod 755 {} \;

  • 1 Users Found This Useful