Magento-Logo-600x255
Hello guys. It’s Morgan from the TMDHosting Genius Support team. Today I have decided to share with you an easy solution for error that sometimes may appear on your Magento stores, while switching servers. The error states the following:

“Could not determine temp directory, please specify a cache_dir manually”

In other words, Magento is not able to find the “tmp” directory used for storing temporary files and you will need to specify it manually. The issue can be solved pretty simple. For the purpose of this article I will assume that your Magento store is located in the /publuic_html/ directory of your account. To resolve the issue, connect to your account via FTP.  Create a folder called “tmp” within:

/public_html/var/

Give that folder permissions of 755 or 777. Now using a text editor like notepad open the following file:

/public_html/lib/Zend/Cache/Backend.php

 

Around line 194, find the following code:

if ($this->_isGoodTmpDir(‘\\temp’)) {
return ‘\\temp’;
}

And change it to:

if ($this->_isGoodTmpDir(‘var/tmp’)) {
return ‘var/tmp’;
}

That way you are telling your Magento store to write its temporary files in:

/public_html/var/tmp

This is the directory that we have created in the beginning of this article. Now clear your Magento cache and access your website. It should be loading normally now.

I hope this article was useful for you!