Ask coding questions

← Back to all posts
How to store mysql credentials?
Usagi02808 (0)

I have been trying to store mysql credentials in a .env file, but I couldn't read the .env in php. Does anyone have an idea on how to do this?

Comments
hotnewtop
RoBlockHead (520)

See the PHP documentation on environment variables.

Usagi02808 (0)

@RoBlockHead And where should I put the variables, using the example from the documentation?

RoBlockHead (520)

@Usagi02808 in the environment tab on the sidebar, the lock

Usagi02808 (0)

@RoBlockHead I put it there, however my code still puts a blank space. https://xd.ignacyr.repl.co/lib/contribute/send.php, code:

<?php echo 'My username is ' .$_ENV["USERNAME"] . '!'; ?>