Home > Enterprise >  Change DB_HOST to 127.0.0.1 on dev server?
Change DB_HOST to 127.0.0.1 on dev server?

Time:04-09

So im using XAMPP and laraval 5.x with PHP 7.4, I encountered an error when loading up my webpage where it wasn't able to access my database. I found an answer online where it said to change db_host to 127.0.0.1 instead of locahost in the database.php file. This ended up fixing my issue and the site works locally. Now I'm going to need to eventually upload the code to the dev server and it would overwrite the database.php file. Would this cause some sort of conflict on the server? Im not a server programmer I'm just fixing some stuff and learning it while I do. Thanks for your help

CodePudding user response:

You must enter actual URL of database.

If it's accessible via localhost on dev server, then it's fine. Otherwise put actual URL.


localhost is alias to IP 127.0.0.1

CodePudding user response:

no Don't do it

localhost is IP of your PC

use other host as Live(production) server

CodePudding user response:

Laravel utilizes the DotEnv library to configure different environments. You can follow the Laravel documentation on how to generate an .env file for each environment (local and dev server).

  • Related