Tuesday, March 6, 2012

Magento Error: “Could not determine temp directory, please specify a cache_dir manually” after Magento is installed"

When we install Magento, some times we may have the error “Could not determine temp directory, please specify a cache_dir manually”, when clicking on some pages in both backend and frontend.

Usually it will happen in shared web hosting, but also some times on individual server, if the permission of tmp folder is set wrong.

Many people suggest to modify the file:
/lib/Zend/Cache/Backend/File.php” to fix this problem. However, it may be a trap when you upgrade your Magento, as this file resides as core file of Magento. I recommend to use Magento’s override feature.

Firstly, copy “/lib/Zend/Cache/Backend/File.php” to “/app/code/local/Zend/Cache/Backend/File.php”.

Then on line 91 or near this line, you will find:
'cache_dir' => null,
Change to:
'cache_dir' => "var/tmp/",

You can change the cache folder wherever you want.
Now create a directory named tmp(or whatever name you have given above) under var folder and change the permission to 777 if necessary.

Now, your Magento should be run smoothly.

No comments: