-2

I want to upload a Laravel 5.2 project on live server.when I upload it and try to run then give me 500: Internal-Server Error.

How Can I Fix This?

hanann
  • 9
  • 3

2 Answers2

-1

In the most cases, this error happens because of folders and files permissions (in the case of laravel, may be the .env missing)

To fix this, check if you have the .env file in your folder

If not:

Generate your .env:

cp .env.example .env

Generate your key:

php artisan key:generate

After that, give the correct permissions to your laravel folder.

Enter in the laravel project

cd my_project_folder

Add the 644 permission to files and 755 to folders:

find ./ -type f -exec chmod 644 {} \;
find ./ -type d -exec chmod 755 {} \;

Clear your cache

php artisan cache:clear
php artisan config:clear
php artisan view:clear

If another error appears, try to update your composer

composer update
João Mantovani
  • 2,230
  • 1
  • 21
  • 33
  • There are many, many causes for an error 500 this wouldn't solve. Missing required PHP extensions, different versions of PHP, different error reporting settings, etc. Better to first look at the logs before going around chmodding everything randomly. – ceejayoz Mar 23 '17 at 14:59
  • I'm not setting randomly permissions, a lot of answer in stackoverflow recommend that, [here for example](http://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others) – João Mantovani Mar 23 '17 at 15:05
  • Given OP's comment that the logs show `local.ERROR: exception 'ErrorException' with message 'Use of undefined constant apple - assumed 'apple''` this has **nothing** to do with permissions, and as such, changing permissions **is** pointless random flailing. – ceejayoz Mar 23 '17 at 15:38
-1

First Check if the domain is redirecting to your public folder.

If yes , check the .env file and the database is conected . Clear all the cache manually :

Bootstrap : services.php, settings.php Delete

Storage/Framework/Cache Delete all files

Storage/Framework/session Delete all files

Storage/Framework/views Delete all files

or if you have ssh access :

php artisan cache:clear php artisan config:clear php artisan view:clear

If still not working . check if the permmisons for storage folder are correct. good luck :)

OMR
  • 11,736
  • 5
  • 20
  • 35
Roland Allla
  • 388
  • 4
  • 13
  • A 500 error is almost always caused by an issue with the code and generates a useful error in a log file. This is fairly pointless flailing around in the dark for the described problem. – ceejayoz Mar 23 '17 at 14:58