I am trying to installed Magento 2.3.4 in CentOS bases server. And getting below error:

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/mage2/var/page_cache" is not writable in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...') #1 /var/www/html/mage2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...') #2 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /var/www/html/mage2/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /var/www/html/mage2/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(38): Magento\Framework in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

Already I ran below commands:

sudo chmod -R 777 var/ pub/ generated

Seems like file & folder owner|group issue. Then, I created one user and assigned it to apache group and ran below command to change file & folder owner|group

sudo chown -R magento_user:apache * .[^.]*

sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; 

sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;   

sudo chmod u+x bin/magento

sudo service httpd restart

I installed Magento using CLI with below command and got success message

php bin/magento setup:install --base-url=http://domain.com/ --db-host=localhost --db-name=dbname --db-user=dbuser --db-password=dbpass --admin-firstname=Rajiv --admin-lastname=Ranjan --admin-email=rajiv@gmail.com --admin-user=admin --admin-password=admin@123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

Still I am not getting same 'write permission' error while accessing from browser.

Any help is much appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.