#m2.0
1 messages · Page 1 of 1 (latest)
Hello! Can you confirm that line 8 of index.php looks like this?
$dotenv = Dotenv\Dotenv::create(__DIR__);
Hello
Yes I confirm it
What version of PHP are you using?
I'm using php 8, should I use another one?
That should be fine. That's a strange error. What version of phpdotenv got installed?
It looks to me like it's the version listed in the composer file...I just did the command 'composer install'
And you copied the .env.example file to .env and changed the content?
Yes that's right, I did everything as instructed.
here is a screenshot of the folders.
I may have made a mistake, do you see a problem?
You need to move .env inside the php directory.
Or you need to change line 8 to point to the .env file in its current location.
I actually moved the .env to the server directory as you can see in the 2nd screenshot...
Please excuse my amateurism, could you give me an example to point line 8 to the env file
Wait, sorry, I think I got confused there. So you have the .env file alongside the index.php file, correct?
And running the sample still shows the same error as before?
Exactly the error is still present
the same error ... I've been on it for a few hours and I don't understand where the problem comes from
Still looking...
do you encounter this problem if you install this sample?
Just trying that now... and I do get the same error! Interesting...
Looks like this code is a bit out of date, give me a few minutes...
Very well thank you
It looks like the versions in the composer.json file were changed unexpectedly. This is what should be in composer.json:
{
"require": {
"slim/slim": "^3.12",
"vlucas/phpdotenv": "^3.4",
"stripe/stripe-php": "^7.7.1",
"monolog/monolog": "^1.17"
},
"scripts": {
"start": "php -S localhost:4242 index.php"
}
}
Once you update that, delete the vendor and composer.lock files, then run composer install again and see if that gets things working.