localhost is currently unable to handle this request HTTP ERROR 500 in Codeigniter3

I use MAMP for MAC and I had a project on my local. It worked well. I decided to update this project and downloaded from my web server after what localhost shows 500 error.

enter image description here

However, when I enter another localhost projects, it works. I use Codeigniter3 framework. Where can be the problem?

1 answer

  • answered 2018-01-11 21:40 Alex

    CodeIgniter in the index.php file has options for different environments production and development and supports having subdirectories of the same name in the config folder with different configs depending on the environment. My guess is that the first line of the index.php file says this define('ENVIRONMENT', 'production'); and points to a production database in /application/config/production/database.php (as you downloaded it from a production server) - and as a result you can't connect nor are you getting any errors as by default the production environment serves no errors just a 500 page if something went wrong.

    If you don't have different subdirectories for production and development than you just have one config.php and one database.php file in the main config directory. Change the database.php to reflect your local development databasename, password, .etc. and change the environment define to development define('ENVIRONMENT', 'development');.

    At the very least you should begin to get errors by changing to development.

    Otherwise its a more complex problem to locate.