There was a problem loading the comments.

How to fix an "500 Internal Server Error"

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Issue: 500 Internal Server Error

We have seen this error come-up when client's migrate scripts to our server. Client attempt to install a PHP script (such as Drupal, Magento, Moodle, Wordpress, Concrete5 etc…) from sources or previous installation of LAMP with mod_php. Upon testing the installation on IndicHosts server, an error  '500 Internal Server Error'  is observed on web browser.

 

Common sources of the issue are;

  1. Directory or File permissions
  2. Directory or File ownership
  3. Directives in .htaccess such as  php_value  or  php_flag

 

Reason & Background: As our server runs apache with suPHP and does not use mod_php, PHP scripts are executed as 'username' instead of ‘apache’ or ‘nobody’. Hence all your script files and subdirectories need to be owned by username. In addition, most script's documentation is focused towards basic LAMP (Linux, Apache, MySQL, PHP) with mod_php deployments. The script's documentation recommend that certain directories and files should be set to world writable (i.e. 777 or 666.). Often PHP files, as part of source archive, are distributed with the executable permission of 777 or 775.

On IndicHosts servers, you should NOT have any world writable files or directories (with permission levels such as 0777, 0666, 0770, 0660, etc.) and our PHP script files (.php) should NOT be executable (with permission levels such as 0755) even if the official script documentation recommends that. This is a mandatory security requirement for PHP scripts on IndicHosts servers.  

Hence to correct the 500 Internal Server Error on IndicHosts.net server, you need to do the following;

  1. All directories and subdirectories should be set to permission level of 0755. You can do correct this using FTP  or  by running this command in cPanel  >>  Terminal 

    chmod 755 directory


  2. All files in directory and subdirectories should be set to permission level of 0644. You can do correct this using FTP  or  by running this command in cPanel  >>  Terminal 

     chmod 644 filename.php

  3. Check and remove any php_value or php_flag directives in your .htaccess file. (by removing the line or commenting it out with # prefix)

  4. The files and directories should be owned by user that they belong to. If the username is ‘robert’ the files should be owned and grouped as robert:robert . You can do correct this by running this command in cPanel  >>  Terminal   (If you don't have terminal enabled, raise a ticket and ask us enable terminal on your domain)

    chown username:username directory
    chown username:username filename.php 

  5. Incorrect version of PHP gives "HTTP Error 500" on Google Chrome.  At times PHP version enabled on the domain does not meet the requirement of the script. You can use the PHP Selector or MultiPHP Manager in cPanel to change your version of PHP. We provide PHP versions 4.4 upto 8.1 for clients to choose for their domain.

  6. ModSecurity block gives "HTTP Error 500" on Google Chrome. Please navigate to cPanel >> ModSecurity and disable ModSecurity on the domain. If the error goes away, raise a ticket with Technical Support to ask them for the ModSecurity rule which caused the exception, then contact the script developer and ask them to fox their script.

  7. Check the script documentation and ensure that the PHP environment meets the minimum requirements of the script (php extensions, options, variable are enabled). To learn how-to setup PHP-environment at IndicHosts on per-domain or per-directory basis, read our PHP Setup how-to article. (Note: If you find at any point that the script requirement conflicts with our Setup Article here, please contact us for a clarification on how to proceed.)

 

Once you have rectified the above, refresh the script URL. If the error persists, please raise a ticket with the script details.

 

Tip: the error_log file in the script directory shows the exact PHP error behind the 500 internal server error


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net