"无法确定临时目录,请手动指定cache_dir"

gSo*_*rry 9 caching magento

Magento管理员抛出异常:

无法确定临时目录,请手动指定cache_dir

这是新托管包的新安装.

Moh*_*ora 42

通常情况下,如果tmp文件夹的权限设置错误,它将在共享的Web托管中发生,但有时也会在单个服务器上发生.

很多人建议修改文件: /lib/Zend/Cache/Backend/File.php解决这个问题.但是,当您升级Magento时,它可能是一个陷阱,因为此文件位于Magento的核心文件中.我建议使用Magento的覆盖功能.

首先,复制/lib/Zend/Cache/Backend/File.php/app/code/local/Zend/Cache/Backend/File.php.

然后在第91行或接近此行,你会发现:

'cache_dir' => null,
Run Code Online (Sandbox Code Playgroud)

改成:

'cache_dir' => "var/tmp/",
Run Code Online (Sandbox Code Playgroud)

您可以在任何位置更改缓存文件夹.现在在var文件夹下创建一个名为tmp(或上面给出的任何名称)的目录,并在必要时将权限更改为777.


Vin*_*war 6

这只是许可问题.只需将777权限设置为缓存目录,即可完成所有操作.试试吧.

有关详细信息,请单击链接.

当你设置权限时,请确保它被重复设置..

chmod 777 -R/var/cache

这是功能


    public function getTmpDir()
        {
            $tmpdir = array();
            foreach (array($_ENV, $_SERVER) as $tab) {
                foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
                    if (isset($tab[$key])) {
                        if (($key == 'windir') or ($key == 'SystemRoot')) {
                            $dir = realpath($tab[$key] . '\\temp');
                        } else {
                            $dir = realpath($tab[$key]);
                        }
                        if ($this->_isGoodTmpDir($dir)) {
                            return $dir;
                        }
                    }
                }
            }
            $upload = ini_get('upload_tmp_dir');
            if ($upload) {
                $dir = realpath($upload);
                if ($this->_isGoodTmpDir($dir)) {
                    return $dir;
                }
            }
            if (function_exists('sys_get_temp_dir')) {
                $dir = sys_get_temp_dir();
                if ($this->_isGoodTmpDir($dir)) {
                    return $dir;
                }
            }
            // Attemp to detect by creating a temporary file
            $tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
            if ($tempFile) {
                $dir = realpath(dirname($tempFile));
                unlink($tempFile);
                if ($this->_isGoodTmpDir($dir)) {
                    return $dir;
                }
            }
            if ($this->_isGoodTmpDir('/tmp')) {
                return '/tmp';
            }
            if ($this->_isGoodTmpDir('\\temp')) {
                return '\\temp';
            }
            Zend_Cache::throwException('Could not determine temp directory, please specify a cache_dir manually');
        }

在文件lib/Zend/Cache/Backend.php中定义

http://www.webtechnologycodes.com/magento-error-could-not-determine-temp-directory-please-specify-a-cache_dir-manually/