'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?



Solution 1:[1]

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.

Solution 2:[2]

For me I have been using the 127.0.0.1 it was giving the error but, I am trying it using localhost, it's working properly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex
Solution 2 12athos