4

I'm having troubles using special chars in values of a Laravel .env file. For example:

DB_PASSWORD=some#secret

Now the env('DB_PASSWORD') is just 'some'

Is there a way to escape characters or some other method to use values like this in the .env file?

In case it makes a difference, my server is running on CentOS 8.2.2004

UPDATE: Forget the whole thing. It turned out it was a different issue altogether. Answer below is correct on the actual question though.

Arno van Oordt
  • 2,912
  • 5
  • 33
  • 63

1 Answers1

12

# is for commenting in a .env file. If you want to use # as a value, you need to wrap it in ":

DB_PASSWORD='some#secret'
AnasSafi
  • 5,353
  • 1
  • 35
  • 38
Tim Lewis
  • 27,813
  • 13
  • 73
  • 102