Fatal error: Uncaught Magento\Framework\Exception\FileSystemException: The "/Library/WebServer/Documents/magento/var/.regenerate" file can't be deleted. Warning!unlink(/Library/WebServer/Documents/magento/var/.regenerate): Permission denied in /Library/WebServer/Documents/magento/vendor/magento/framework/Filesystem/Driver/File.php:383 Stack trace: #0 /Library/WebServer/Documents/magento/vendor/magento/framework/Filesystem/Directory/Write.php(184): Magento\Framework\Filesystem\Driver\File->deleteFile('/Library/WebSer...') #1 /Library/WebServer/Documents/magento/vendor/magento/framework/Code/GeneratedFiles.php(99): Magento\Framework\Filesystem\Directory\Write->delete('/var/.regenerat...') #2 /Library/WebServer/Documents/magento/vendor/magento/framework/App/ObjectManagerFactory.php(111): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles() #3 /Library/WebServer/Documents/magento/vendor/magento/framework/App/Bootstrap.php(210): Magento\Framework\App\ObjectManagerFactory->create(Array) #4 /Library/WebServer/Documents/m in /Library/WebServer/Documents/magento/vendor/magento/framework/Filesystem/Driver/File.php on line 383
Solved! Go to Solution.
Hello @masarah_fas
Kindly set writable permission to your VAR directory, then error gets resolved !
cd <your Magento install dir> find . -type f -exec chmod 644 {} \; // 644 permission for files find . -type d -exec chmod 755 {} \; // 755 permission for directory find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder find ./pub/media -type d -exec chmod 777 {} \; find ./pub/static -type d -exec chmod 777 {} \; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml chown -R :<web server group> . chmod u+x bin/magento
For more details refer this link - https://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions
Hope it helps !
Hello @masarah_fas
Kindly set writable permission to your VAR directory, then error gets resolved !
cd <your Magento install dir> find . -type f -exec chmod 644 {} \; // 644 permission for files find . -type d -exec chmod 755 {} \; // 755 permission for directory find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder find ./pub/media -type d -exec chmod 777 {} \; find ./pub/static -type d -exec chmod 777 {} \; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml chown -R :<web server group> . chmod u+x bin/magento
For more details refer this link - https://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions
Hope it helps !
Never set 777, Never.
@Manthan Dave wrote:Hello @masarah_fas
Kindly set writable permission to your VAR directory, then error gets resolved !
cd <your Magento install dir> find . -type f -exec chmod 644 {} \; // 644 permission for files find . -type d -exec chmod 755 {} \; // 755 permission for directory find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder find ./pub/media -type d -exec chmod 777 {} \; find ./pub/static -type d -exec chmod 777 {} \; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml chown -R :<web server group> . chmod u+x bin/magentoFor more details refer this link - https://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions
Hope it helps !
There can be another solution.
If you had run:
`$ chmod -R 777 var pub generated`
and nothing was happen (still 500 error on website access)
Then, restart the container (docker has a button for that).
Enjoy!