I have installed Magento on Windows with IIS 8. When I try to add a new product I get a message:

"Could not determine temp directory, please specify a cache_dir manually"

Error message on Products page

When I click the 'Add Product' button anyway I don't get a data entry form that I would expect - it's mostly blank.

Blank new product screen

I have looked around at solutions, but they all seem to focus on versions earlier than (e.g. this one applies to and this is important because there is no app/code/core/Zend/Cache/Backend/ folder as described in that solution. There is however:

lib/internal/Cm/Cache/Backend and a File.php there. I have changed line 42 here to:

    'cache_dir' => 'var/tmp/', 

(Even though hacking away at the file in 'lib' doesn't feel right).

Still the message and problem persists.

3 Answers 3


This error is not Magento-specific. It relates to Zend Cache.

Set sys_temp_dir in php.ini to a path that can be reached by IUSR then restart IIS to apply changes.


Not sure if this will solve the issue, but it is possible to specify custom directories for cache (and other directories declared in \Magento\Framework\App\Filesystem\DirectoryList::getDefaultConfig) during Magento installation using command line argument: --magento-init-params=MAGE_DIRS[cache][path]=/var/tmp/magento/var/cache&MAGE_DIRS[tmp][path]=/var/tmp/magento/var/tmp

Also, MAGE_DIRS should be initialized using SetEnv in web server config (e.g. in virtual host config), so that custom directories are used during each request processing.


If you got no rights to edit the php.ini, you can set up a PHP mod-version. Now use the following in your .htaccess

SetEnv TEMP /www/htdocs/your/path/mage/var/tmp
SetEnv TMP /www/htdocs/your/path/mage/var/tmp
SetEnv TMPDIR /www/htdocs/your/path/mage/var/tmp

You will need that for web hosters that support this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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