7

I am facing a issue while trying to install magento. I am getting the following errors. Plz can any one help me...!

OS: Ubuntu 16.0.4
apache: 2.4.18
php: 7.0.8
mariaDB: 10.1.16

Fatal error: Uncaught Magento\Framework\Exception\FileSystemException: The file "/opt/lampp/htdocs/magento/var/.regenerate" cannot be deleted Warning!unlink(/opt/lampp/htdocs/magento/var/.regenerate): Permission denied in /opt/lampp/htdocs/magento/vendor/magento/framework/Filesystem/Driver/File.php:382 Stack trace: #0 /opt/lampp/htdocs/magento/vendor/magento/framework/Filesystem/Directory/Write.php(173): Magento\Framework\Filesystem\Driver\File->deleteFile('/opt/lampp/htdo...')
#1 /opt/lampp/htdocs/magento/vendor/magento/framework/Code/GeneratedFiles.php(98): Magento\Framework\Filesystem\Directory\Write->delete('/var/.regenerat...')
#2 /opt/lampp/htdocs/magento/vendor/magento/framework/App/ObjectManagerFactory.php(114): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles() #3 /opt/lampp/htdocs/magento/vendor/magento/framework/App/Bootstrap.php(385): Magento\Framework\App\ObjectManagerFactory->create(Array) #4 /opt/lampp/htdocs/magento/vendor/magento/framework/App/Bootstrap.php(362): Magento\Framework\App\Bootstrap- in /opt/lampp/htdocs/magento/vendor/magento/framework/Filesystem/Driver/File.php on line 382
12

Your var folder does not have the right permissions.

I suggest you follow the official documentation to set the right permissions on your Magento instance: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
chmod u+x bin/magento
3

You can easily solve this by going to the document root via terminal and providing permission to var folder like this:

chmod -R 777 var

Then please trying refreshing and the installation mode will be shown for sure.

1

If someone is facing the same permission issues (i.e. /var/.regenerate Can't be deleted, in the httpd logs) And none of the below works:

  1. chmod -R 777 var
  2. server user match the ownership of your files
  3. open_basedir is disabled or correctly set in php.ini

Try to check if your Centos 7 installation has SELinux installed: sestatus If it is, disable it: setenforce 0

  • Although not ideal, setenforce 0 did the trick for me. I would stay away from setting 777 on any file. – vahissan Feb 13 at 5:45
  • absolutely agree. it might be handy during the initial setup, and if with 777 set you still get permission errors than it's definitely something else. Also, setenforce 0 temporarily disables SELinux. You'd need to edit /etc/selinux/config in order to disable it permanently or to set the right policy. – Mike Feb 13 at 22:07
0

I face almost same problem. Instead of searching randomly on internet randomly, go on log file of apache2, in my case my log file located on

/var/apache2/log

then you will found exact problem there.

for my case i found the following error.

[Sat Nov 10 15:48:36.673289 2018] [:error] [pid 2153] [client 127.0.0.1:40744] PHP Fatal error: Uncaught RuntimeException: Can’t create directory /var/www/html/M2/MN226/generated/code/Magento/Framework/App/ResourceConnection/.\nClass Magento\Framework\App\ResourceConnection\Proxy generation error: The requested class did not generate properly, because the ‘generated’ directory permission is read-only. If — after running the ‘bin/magento setup:di:compile’ CLI command when the ‘generated’ directory permission is set to write — the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. in /var/www/html/M2/MN226/vendor/magento/framework/Code/Generator.php:135\nStack trace:\n#0 /var/www/html/M2/MN226/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass(‘Magento\\Framewo…’)\n#1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load(‘Magento\\Framewo…’)\n#2 [internal function]: spl_autoload_call(‘Magento\\Framewo…’)\n#3 /var/www/html/M2/MN226/vendor in /var/www/html/M2/MN226/vendor/magento/framework/Code/Generator.php on line 135, referer: http://localhost/M2/

my installation directory is var/www/html/M2/MN226/

Then on that directory you can found a folder call generated.

check the permission of that if not given 777

then give that 777

then everything work correct.then

enter image description here

Note : i just share my experience, it can help you or not, as everyone situation may not be same. If it's work then okay, If no then ignore it. I white it on :

https://forum.equaltrue.com/topics/showing-blank-page-while-installing-magento-2-2-6/

0

The solution from Raphael at Digital Pianism was not solving it for me, I had to execute this command which are three commands chained together:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + && chmod g+x bin/magento

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.