CodeIgniter 500 Internal Server Error

I downloaded a PHP script written using CodeIgniter. when i run it from localhost going to admin folder it shows localhost again. Also, when launched from my web host, it shows 500 internal server errors.

I start the site from http: // localhost / myproj It works. Then, when I try to go to the admin page, which is located at http: // localhost / myproj / administrator , it gives 500 internal server errors.

I read here that this could be due to incorrect code in the .htaccess file. This is my current .htaccess file

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] 

 # Without mod_rewrite, route 404 to the front controller ErrorDocument 404 /index.php 

Please help me. I know this can be a very small problem, but I cannot find the error.

+9
source share
11 answers

The problem with 500 errors (with CodeIgniter), with various apache settings, displays 500 errors when an error occurs with PHP settings.

Here's how it might cause a 500 error using CodeIgniter:

  • Error in the script (invalid PHP configurations, missing packages, etc.)
  • PHP "Fatal Error"

Please check your apache error logs, there should be some interesting information there.

+21
source

Just in case someone else runs into this problem, I inherited an older CodeIgniter project and had big problems installing it.

I spent a lot of time trying to create a local installation of the site and tried everything. In the end, the decision was simple.

The problem is that older versions of CodeIgniter (e.g. 1.7 and below) do not work with PHP 5.3. The solution is to upgrade to PHP 5.2 or something older.

+4
source

You are trying to remove index.php from the URL of your site, right?

Try $config['uri_protocol'] to REQUEST_URI instead of AUTO .

+2
source

delete comment in httpd.conf (apache configuration file):

 LoadModule rewrite_module modules/mod_rewrite.so 
+1
source

Try this in your .htaccess file:

 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule > 
+1
source

Whenever I run CodeIgniter in a subdirectory, I install RewriteBase for it. Try setting it as /myproj/ instead of / .

0
source

This probably doesn't apply to this topic anymore, but hopefully is helpful to someone. I had 500 errors in the last hour since I had a controller returning an array not supported by the php version on my (crap) server. Seems trivial, but has the distinguishing features of a codeigniter error.

I had to use:

 class emck_model extends CI_Model { public function getTiles(){ return array(...); } } 

Instead

 class emck_model extends CI_Model { public function getTiles(){ return [...]; } } 

Greetings

0
source

I know I'm late, but that will help someone.

Check if rewritable engine is enabled.

If not, enable reboot and restart the server.

 sudo a2enmod rewrite sudo service apache2 restart 
0
source

if Wampserver Version 2.5 changes apache configuration as

httpd.conf (apache configuration file): From

 #LoadModule rewrite_module modules/mod_rewrite.so** 

To remove #

 LoadModule rewrite_module modules/mod_rewrite.so** 

this works great for me

0
source

This works great for me.

 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule > 
0
source

Make sure your root index.php file has the correct resolution, its resolution must be 0755 or 0644

0
source

All Articles