I have successfully installed Magento in mylocalhost server and when i tried to open the admin and index i got this error
[Wed Aug 01 00:47:57.088443 2018] [php7:error] [pid 12976] [client ::1:48615] PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/magento2/var/page_cache" is not writable in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php:209nStack trace:n#0 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')n#1 /var/www/html/magento2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')n#2 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)n#3 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)n#4 /var/www/html/magento2/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)n#5 /var/www/html/magento2/lib/internal/Magento/Framework/Cache/Frontend/Ada in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209, referer: http://localhost/
Have tried to do chmod 777 /var/www/html/magento2/var/page_cache still returning error
2
Answers
Simply write permissions needed on your cache directory
chmod 777 /var/www/html/magento2/var/page_cache
Or even just the full var directory:
chmod 777 /var/www/html/magento2/var – R
For security, those permissions aren’t recommended on a production setting but should be fine for local development.
You basically need to make that directory writable by the web server, but that depends on your system setup and is a more complex answer. Probably overkill for this context
just change the permissions of directory “/var/www/html/magento2/var/page_cache” to 777
using following command.
If there is no such directory, probably you need to create directory at given location and change the permissions.