Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Benja's avatar
Level 21

deploying laravel 5.4 for production

i have been trying to deploy a laravel 5.4 application on a production server but am getting a 500 response, i have set all my permissions but i cant seem to get rid of the error..

you can visit intellect.co.ke to see my error

0 likes
16 replies
mdecooman's avatar

Can you give more information? Like the host, the http server, your config files, whatever that can help understanding the issue? A 500 response is a bit short.

gustav1105's avatar

500 errors are due to a problem in your code, check your controllers.

Benja's avatar
Level 21

@mdecooman when i access the domain on a browser,i get i HTTP ERROR 500 , i had installed a fresh installation of laravel 5.2 and it worked perfectly, but when i nstalled laravel 5.4 the same way i installed laravel 5.2, i get the 500 error, its a fresh install of laravel 5.4, so am assuming its somth to do with maybe permission or .htaccess

lmxdev's avatar

never 777 on storage...

sudo chown -R :www-data /var/www/yourproject
sudo chmod -R 775 /var/www/yourproject/storage
sudo chmod -R 775 /var/www/yourproject/bootstrap/cache
mikevrind's avatar

Did you upload your .env file with a APP_KEY? Did you run composer install (happened to me once)? Are the storage folder writeable? Is the bootstrap/cache folder writeable? Did you check the logfiles to see what triggers the 500 error?

Laravel requires at least PHP5.6.4. Which version of 5.6 are you using?

gustav1105's avatar

I found a thread stating use PHP v5.6.4 or higher, might be something to look at, although at this point it is just a guess

Benja's avatar
Level 21

looking at the apache error logs, i find this

[Thu Apr 13 12:35:49.886519 2017] [:error] [pid 15902] [client 196.101.117.244:60844] PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIAB$$VARIABLE) in /var/www/company/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 480

Benja's avatar
Benja
OP
Best Answer
Level 21

solved it!!!! yeeeeeey!!!

so...the problem is, laravel 5.4 requires php version 5.6 so you need to upgrade your php version, but apache will still use the older php version even if you upgrade your php version since apache will not use your default CLI php version unless you tell it to, this command is a quick fix by telling apache to use php version 5.6

sudo a2dismod php5 && sudo a2enmod php5.6 && sudo service apache2 restart

2 likes

Please or to participate in this conversation.