简体   繁体   中英

500 Internal Server Error in CodeIgniter application

I did some work locally on CodeIgniter web application. It works fine locally but when uploaded to live server.

I get blank page and when checked through the Firebug, I got internal server error message in console of Firebug.

I am searching for solution from 2 days and there are a lot of answers to internal server error like .htaccess might be misconfigured or mod_rewrite might not be enabled etc.

Here what I have tested so far.

1. mod_rewrite is working fine on cpanel linux shared hosting server. Also tested it to make sure by creating a simple .htaccess file and test2.php file.

在此处输入图片说明

2. .htaccess seems fine to me, I have tried many other approaches but no use, however this .htaccess works for me on wampp and xampp servers locally.

    DirectoryIndex index.php <IfModule mod_rewrite.c>

    Options +FollowSymLinks -Indexes    RewriteEngine on

    #RewriteBase /projects/HouseRentSystem  RewriteBase /demos/hrs
     # Hide the application and system directories by redirecting the request to index.php
     RewriteRule ^(application|system|\.svn) index.php?/$1 [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>

 <IfModule !mod_rewrite.c>
     ErrorDocument 404 index.php </IfModule>

But to make sure, I have also tried to remove the .htaccess and directly accessed the controller by using the index.php in url. but no success there so its not .htaccess issue as even with index.php I get the internal server error.

3. Tested if base URL or database settings might not be ok. But they are OK.

I am confused what to check more? Why I can't make this application to work on my shared hosting?

Here is the application link getting error. It's a blank page. Error shows in console.

在此处输入图片说明

Checked the Error log in cPanel to see if any error there, but it's empty.

在此处输入图片说明

Update:

Thanks to @vinod Tigadi

Finally found out some issues.

Error log of cpanel is empty, but needed to check the error log in root folder of my application/project.

Plus I had prefix defined in config was

$config['subclass_prefix'] = 'MY_';

whereas my main controller file name was My_Controller, y was small. I could not know of this change because of blank page and no errors and didn't knew of error log file location.

I have checked your other applications and found that most of them are working except for the 'hrs'. You should adopt the step by step approach.

  1. First, rename the index.php that comes with codeigniter and create your own index.php or index.html and try acccessing the same. See if it works or not
  2. If still not working, then delete the .htaccess file and try accessing those newly created index files and check
  3. If your are able to access the index files with the .htaccess file then there should be some issue with CodeIgniter. For which you should start enabling the DEBUG mode
  4. If you find that issue with CodeIgniter, then once again restore the index.php of the CodeIgniter and modify your config.php for $config['log_threshold'] = 4 . Then in the index.php add the below code

     error_reporting(E_ALL); ini_set('display_errors', 1); 

    Then try the application.

Hope by this, you should be able to get the error details. Let us know the information so that we can help you further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM