Symfony Dotenv error

Username (e.g. epiz_XXX) or Website URL

http://coronavirus-tracker.infinityfreeapp.com/

Error Message

Warning : is_file(): open_basedir restriction in effect. File(/home/vol2_6/epizy.com/epiz_27282262/.env.local.php) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol2_6/epizy.com/epiz_27282262/htdocs) in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php on line 151

Warning : is_file(): open_basedir restriction in effect. File(/home/vol2_6/epizy.com/epiz_27282262/.env) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol2_6/epizy.com/epiz_27282262/htdocs) in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php on line 113

Warning : is_file(): open_basedir restriction in effect. File(/home/vol2_6/epizy.com/epiz_27282262/.env.dist) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol2_6/epizy.com/epiz_27282262/htdocs) in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php on line 113

Warning : is_readable(): open_basedir restriction in effect. File(/home/vol2_6/epizy.com/epiz_27282262/.env) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol2_6/epizy.com/epiz_27282262/htdocs) in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php on line 564

Fatal error : Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the “/home/vol2_6/epizy.com/epiz_27282262/.env” environment file. in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php:565 Stack trace: #0 /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php(92): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array) #1 /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->load(‘/home/vol2_6/ep…’) #2 /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv(‘/home/vol2_6/ep…’, ‘APP_ENV’, ‘dev’, Array) #3 /home/vol2_6/epizy.com/epiz_27282262/htdocs/index.php(10): Symfony\Component\Dotenv\Dotenv->bootEnv(‘/home/vol2_6/ep…’) #4 {main} thrown in /home/vol2_6/epizy.com/epiz_27282262/htdocs/symfony/vendor/symfony/dotenv/Dotenv.php on line 565

Other Information

my project structure is:
htdocs / -css -img -js -public_html -symfony(which contains those directories like :src ,bin,config,vendor etc ) -.htaccess -file for your web... -index.php -index2.html

The software tries to access files outside the htdocs (.env). Can you modify the code and move the .env file?

5 Likes

Thanks mate , it worked . I had to modify index.php .

From (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');

To (new Dotenv())->bootEnv(dirname(__DIR__).'/htdocs/.env');

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.