1
votes

I'm using Symfony 4 and Hostgator's shared hosting.

I'm trying to deploy my app to the site. I have uploaded the app to the server and then moved and configured the index.php to the public_html folder. When I ran the site I got this error on the .env file.

Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "/home4/xxx/public_html/yyy/../.env" environment file. in /home4/xxx/yyy/vendor/symfony/dotenv/Dotenv.php:54 Stack trace: #0 /home4/xxx/public_html/yyy/index.php(15): Symfony\Component\Dotenv\Dotenv->load('/home4/xxx/pu...') #1 {main} thrown in /home4/xxx/yyy/vendor/symfony/dotenv/Dotenv.php on line 54

I have read that the environmental file should only be use on development stage, that's probably why the exception. But then what exactly I need to do next?

1

1 Answers

2
votes

Based on your error it looks like a permissions issue. Double check your folders have (drwxr-xr-x)/(755) and files have (-rw-r--r--)/(644).

This may also help you in your setup: http://symfony.com/doc/current/setup/file_permissions.html

Additional Information:

Symfony uses the .env in any environment other than production. Production environment is set using server variables APP_ENV=prod. If it is not set, it is loading from the .env file. public/index.php will give you a little more insight.