Skip to content

Installing demo with --no-dev doesn't work #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tavy315 opened this issue Mar 14, 2018 · 5 comments
Closed

Installing demo with --no-dev doesn't work #771

tavy315 opened this issue Mar 14, 2018 · 5 comments

Comments

@tavy315
Copy link

tavy315 commented Mar 14, 2018

If I use:
composer create-project symfony/symfony-demo --no-dev

I'm getting:
[Wed Mar 14 17:12:58 2018] PHP Fatal error: Uncaught Error: Class 'Symfony\Component\Dotenv\Dotenv' not found in D:\test\symfony-demo\public\index.php:21

Is this something normal ?

@javiereguiluz
Copy link
Member

It's an error ... but it's "normal". It's related to Symfony itself and not this application. The DotEnv component is installed only when not using --no-dev. If you don't have DotEnv you need to define some env vars in your server (in this case, APP_ENV var. See https://github.com/symfony/recipes/blob/a067bebf03a2b244cdf82dd4e3eff52de5320ac2/symfony/framework-bundle/3.3/public/index.php#L11).

That's why you usually don't add --no-dev in your local machine (and everything works) but only in your production server, where you are careful to define all the needed env vars.

@tavy315
Copy link
Author

tavy315 commented Mar 15, 2018

Let's suppose that this was my production machine, so adding --no-dev was the right way to do it for me.

Meanwhile, the problem is still there, "DotEnv" being required in index.php. Loooking at [https://github.com/symfony/demo/blob/master/README.md], I can't see any reference for required ENV variables for production.

This might be an issue for beginners, as I don't have a problem doing what's needed, but perhaps we can improve the documentation?

@jkufner
Copy link
Contributor

jkufner commented Mar 15, 2018

I think it would be reasonable to add an explanation to the DotEnv use in index.php. Something like: "Environment variables are not set and DotEnv not installed. See that section in the readme."

@javiereguiluz
Copy link
Member

@tavy315 I reviewed the Symfony Flex recipes that create the public/index.php and I realized that it was recently updated to display a better error message for cases like yours. so in #773 we're updating it. Cheers!

@tavy315
Copy link
Author

tavy315 commented Mar 16, 2018

Ok, thanks for looking into it 👍

@tavy315 tavy315 closed this as completed Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants