Placing .env files ouside the htdocs folder

Hi and welcome to the forum

Scripts can only write to the htdocs directories they are in. Any directories outside the htdocs dir cannot be written - due to the open_basedir restriction (is set for security reasons).


If you create some directory in htdocs and you add a .htaccess file with the content Require all denied, then nobody will be able to access the files directly either.