2
votes

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.

enter image description here

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.

enter image description here

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

enter image description here

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.

1
Don't try to guess what the error is. Check the error log. It should tell you what's going on. - Mike
i checked the error log in cpanel, its empty :( - Sizzling Code
Is csrf_protection enabled? - Rejoanul Alam
@RejoanulAlam No its set to FALSE in my config file.. - Sizzling Code
If you're getting a 500 error it should to be going to some error log file somewhere. I'm guessing you're just looking at the wrong one. I haven't used cpanel for years, but I seem to recall it adding a file called error_log to the directory within your web root when a php error occurs. Check for that. If not, see stackoverflow.com/questions/8955411/…. If you still can't get it, contact your host to have them point you in the right direction. - Mike

1 Answers

7
votes

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.