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

dixitchopra's avatar

Things to take care after deploying

We are launching our application but seems like in Laravel 5, everything is cached or compiled. We upload PHP files but it doesn't reflect in the system like service files or repositories. What things to take care after deploying to Production environment?

I am pissed off after seeing that things are not working after I have uploaded the new file. I have cleared cache files and then ran clear:compiled. I did everything. Any help is appreciated.

0 likes
15 replies
davorminchorov's avatar

.env file is for development, you have to set those vars on the server somewhere. Platforms like Heroku, Digital Ocean or Fortrabbit have a config vars / environment vars page for the app.

dixitchopra's avatar

@Ruffles I am already doing that with .env. I want to know what things should I have to take care after deployment like putting the server down, uploading the files, clearing cache, etc

pmall's avatar

what doesnt work ?

@Ruffles you dont have to set env variables on the server. You can use .env file on production. It is better to set env vars but you dont have to.

1 like
bashy's avatar

Well you haven't really said how you deploy your app but "upload files" tells me it's FTP or similar...

You need to do that (a lot of us use git to pull the files in, it's lovely). You then run composer install and do your migrations. If you have issues after that, please check any logs to see what went wrong...

1 like
dixitchopra's avatar

Yes, I did it using FTP client.

I didn't know about git pull. Do you use any tool for that?

NoorDeen's avatar
  • how do you deploy your applications ?
    • did you use ftp ?
    • or web file manager on cpanel ?
    • or git ?
  • what is the type of host you use ?
    • shared hosting ?
    • digital ocean ?
    • heroku ?
    • or some thing else like envoy or forage ?
NoorDeen's avatar

I don't no any thing about deploying to aws . can you tell me about the details to help ? can you access to the server by the ssh connection ?

NoorDeen's avatar

you need to access the server with ssh . then install composer on it . after installing composer you need to run

composer dump-autoload -o

and enter your project root folder and run

php artisan optimize --force

and this may fix your problem because laravel concatenate all important files in

bootstrap/cache/compiled.php
1 like
dixitchopra's avatar

I have Service Classes and it doesn't get refreshed on the server after compose dump-autoload or artisan optimize command. Any work around on this?

Please or to participate in this conversation.