this post was submitted on 26 Apr 2026
1 points (66.7% liked)

Programming

27024 readers
10 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

The humble .env file is a useful and low-tech way of storing persistent environment variables. Drop the file on your server and let your PHP scripts consume it with glee. But consume it how? There are lots of excellent parsing libraries for PHP. But isn't there a simpler way? Yes! You can use PHP's parse_ini_file() function and it works. But… .env and .ini have subtly different behaviour which …

you are viewing a single comment's thread
view the rest of the comments
[–] luciole@beehaw.org 3 points 3 weeks ago

TLDR:

You should ~~probably~~ use a proper parser rather than hoping your .env looks enough like an .ini to pass muster.

You can probably use a butter knife instead of a flat screwdriver but just do your job properly.