DEV Community

Discussion on: Build a Simple REST API in PHP

Collapse
 
skipperski profile image
marekszyperski

Ok, I use new phpdotenv and many change...

Don't use getenv only $_ENV example $host = $_ENV['DB_HOST'];

and

$dotenv = Dotenv\Dotenv::createImmutable(DIR);
$dotenv->load();
=> "createImmutable"

Collapse
 
shahbaz17 profile image
Mohammad Shahbaz Alam

Thanks for bringing this into my attention.

New version is really good. Also, I have update the guide to reflect the same.

Collapse
 
shahbaz17 profile image
Mohammad Shahbaz Alam

Are you still getting the same error @skipperski ? or have you solved it using the new approach?