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

jwillz21's avatar

Do you need to make changes to your .env to deploy your application

Im trying to deploy my application on an apache server. it is connecting to the database but I wanted to know if I needed to alter my .env file or run a command (like php artisan serve) or if thats only when using it locally.

currently Im getting 404 errors and my endpoints wont work, although my local version is working.

0 likes
7 replies
bobbybouwmann's avatar

You don't need to run php artisan serve, because your server you should "serve" your application now. php artisan serve is only for local development ;)

You should of course update your .env file for your server based on the credentials for example the database or the APP_ENV.

If you get a 404 you might have an error in your application or something is wrong with the settings of apache

bobbybouwmann's avatar

@rin4ik He says he has apache... The whole tutorials is about nginx and third party tools... Not really sure how this is relevant!

jwillz21's avatar

@bobbybouwmann I havent altered the app_env, what values should I put in for the APP_* section of the code?

jwillz21's avatar

should I just change the APP_ENV to dev and APP_URL to the servers url?

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost:8000
Cronix's avatar
APP_NAME=NameOfYourApp (this is used in emails and other things, so your company name?)
APP_ENV=production
APP_DEBUG=false
APP_URL=http://youractualsite.com/

and run php artisan key:generate so it will create a new APP_KEY

of course all of your db credentials, email credentials, etc., need to match the production server, as well as everything else that your project uses

Please or to participate in this conversation.