Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter 500 Internal Server Error

I downloaded a PHP script written using CodeIgniter. when I run it from the localhost, on going to the admin folder, it shows localhost again. Also when running from my web host, it shows a 500 Internal Server Error.

I run the site from http://localhost/myproj It works. Then when I try to go to the admin page which is at http://localhost/myproj/administrator, it gives a 500 Internal Server Error.

I read here that this might be due to a wrong code in the .htaccess file. This is my present .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's to the front controller
ErrorDocument 404 /index.php

Please help me. I know it might be a very small problem, but I'm unable to find the error.

like image 568
acidburn23 Avatar asked Sep 11 '11 11:09

acidburn23


People also ask

Is currently unable to handle this request http error 500 in CodeIgniter?

This error can occur due to many reasons that include PHP fatal issues, error in the script like PHP misconfigurations, missing packages, and so on. Also, if the CodeIgniter is of an older version then it will not work with the updated PHP version. So, setting the PHP to a lower version would be a great idea.

How can I fix 500 error in PHP?

The 500 error can go away by increasing the values set for the max_execution_time and the memory_limit settings. Setting the file permission to 644 or 755 can help in resolving the 500 internal server error. You can try removing the recent code changes to see if the 500 error goes away.

Why do I keep getting error 500?

The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.


2 Answers

You're trying to remove index.php from your site URL's, correct?

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

like image 158
chrishall78 Avatar answered Sep 16 '22 19:09

chrishall78


Try this to your .htaccess file:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule >
like image 45
Pierre Alexandre Avatar answered Sep 17 '22 19:09

Pierre Alexandre