Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Uncaught Zend_Cache_Exception: cache_dir must be a directory


Reply


33 Posts   23586 Views

Avatar
yurigoul

Community Member, 202 Posts

9 April 2010 at 1:50am

Same thing here, fixed it with the solution from xeraa (thank you!).

One extra note is that the system I am currently working on is secured with open_basedir, so I can not even make the /tmp dir writable if I wanted to.

Avatar
joshpennington

Community Member, 4 Posts

14 May 2010 at 7:12am

This solution also worked for me. Thanks xeraa.

Avatar
atticusservices

Community Member, 10 Posts

17 May 2010 at 5:19pm

Edited: 17/05/2010 5:19pm

Same problem. Running 2.4.0 on Snow Leopard w/ MAMP Pro 1.8.4, PHP 5.2.11.

The problem occurs to be in the function getTmpDir() of:
/sapphire/thirdparty/Zend/Cache/Backend.php

The previously mentioned solution ONLY works until reboot.

TEMPORARY SOLUTION:
Comment line 166.
"// if (isset($_ENV['TMPDIR'])) return $_ENV['TMPDIR'];"

Avatar
J2-Paul

Community Member, 51 Posts

23 May 2010 at 5:36am

I am having the same problem. But none of the suggest fixes seem to be working. The issue could be my enviroment. I am in Windows and think most of the guys are in unix.

My enviroment: Win2003 server, PHP5.2.12, mysql 5.1 iis6, Helicon 3 rewrite.

I installed a clean v2.4.0. and get this error on the admin.

Any help much appreciated.

Thanks

[User Error] Uncaught Zend_Cache_Exception: cache_dir must be a directory
GET /admin/

Line 208 in E:\websites\_SilverStripe\Reception-Screen.v2.4\sapphire\thirdparty\Zend\Cache.php

Source

199 *
200 * Note : for perf reasons, the "load" of Zend/Cache/Exception is dynamic
201 * @param string $msg Message for the exception
202 * @throws Zend_Cache_Exception
203 */
204 public static function throwException($msg)
205 {
206 // For perfs reasons, we use this dynamic inclusion
207 require_once 'Zend/Cache/Exception.php';
208 throw new Zend_Cache_Exception($msg);
209 }
210
211 /**
212 * Normalize frontend and backend names to allow multiple words TitleCased
213 *
214 * @param string $name Name to normalize
Trace

Zend_Cache::throwException(cache_dir must be a directory)
Line 153 of File.php
Zend_Cache_Backend_File->setCacheDir(/temp/)
Line 120 of File.php
Zend_Cache_Backend_File->__construct(Array)
Line 152 of Cache.php
Zend_Cache::_makeBackend(File,Array,,)
Line 93 of Cache.php
Zend_Cache::factory(Core,File,Array,Array)
Line 835 of Data.php
Zend_Locale_Data::getContent(en_US,date)
Line 962 of Format.php
Zend_Locale_Format::getDateFormat(en_US)
Line 81 of DateField.php
DateField->__construct(SiteTreeFilterDate)
Line 224 of CMSMain.php
CMSMain->SiteTreeFilterDateField()
Line 369 of ViewableData.php
ViewableData->obj(SiteTreeFilterDateField,,,1)
Line 445 of ViewableData.php
ViewableData->XML_val(SiteTreeFilterDateField,,1)
Line 102 of .cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.Includes.CMSMain_left.ss
include(C:\WINDOWS\Temp\silverstripe-cacheE--websites-_SilverStripe-Reception-Screen.v2.4\.cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.Includes.CMSMain_left.ss)
Line 392 of SSViewer.php
SSViewer->process(CMSMain)
Line 342 of ViewableData.php
ViewableData->renderWith(Array)
Line 483 of LeftAndMain.php
LeftAndMain->Left()
Line 369 of ViewableData.php
ViewableData->obj(Left,,,1)
Line 445 of ViewableData.php
ViewableData->XML_val(Left,,1)
Line 59 of .cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.LeftAndMain.ss
include(C:\WINDOWS\Temp\silverstripe-cacheE--websites-_SilverStripe-Reception-Screen.v2.4\.cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.LeftAndMain.ss)
Line 392 of SSViewer.php
SSViewer->process(CMSMain)
Line 202 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 134 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 283 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 127 of Director.php
Director::direct(admin/)
Line 127 of main.php

Avatar
atticusservices

Community Member, 10 Posts

23 May 2010 at 6:25am

J2-Paul,

This is a temporary fix to at least get you up and running until a better solution is found...

You should be able to replace the function getTmpDir() in "/sapphire/thirdparty/Zend/Cache/Backend.php" with the following:

static function getTmpDir()
{
return "C:\cache\directory\of\your\choice";
}

Avatar
J2-Paul

Community Member, 51 Posts

25 May 2010 at 12:26am

Thanks Atticusservices. However, no dice. This is update I made to "/sapphire/thirdparty/Zend/Cache/Backend.php"

static function getTmpDir()
{
return "C:\temp\cache\ss";
}

I event deleted the existing code.

I get the same error. See trace below.

Thanks in advance for any help.

Paul

******************

[User Error] Uncaught Zend_Cache_Exception: cache_dir must be a directory
GET /admin/

Line 208 in E:\websites\_SilverStripe\Reception-Screen.v2.4\sapphire\thirdparty\Zend\Cache.php

Source

199 *
200 * Note : for perf reasons, the "load" of Zend/Cache/Exception is dynamic
201 * @param string $msg Message for the exception
202 * @throws Zend_Cache_Exception
203 */
204 public static function throwException($msg)
205 {
206 // For perfs reasons, we use this dynamic inclusion
207 require_once 'Zend/Cache/Exception.php';
208 throw new Zend_Cache_Exception($msg);
209 }
210
211 /**
212 * Normalize frontend and backend names to allow multiple words TitleCased
213 *
214 * @param string $name Name to normalize
Trace

Zend_Cache::throwException(cache_dir must be a directory)
Line 153 of File.php
Zend_Cache_Backend_File->setCacheDir(/temp/)
Line 120 of File.php
Zend_Cache_Backend_File->__construct(Array)
Line 152 of Cache.php
Zend_Cache::_makeBackend(File,Array,,)
Line 93 of Cache.php
Zend_Cache::factory(Core,File,Array,Array)
Line 835 of Data.php
Zend_Locale_Data::getContent(en_US,date)
Line 962 of Format.php
Zend_Locale_Format::getDateFormat(en_US)
Line 81 of DateField.php
DateField->__construct(SiteTreeFilterDate)
Line 224 of CMSMain.php
CMSMain->SiteTreeFilterDateField()
Line 369 of ViewableData.php
ViewableData->obj(SiteTreeFilterDateField,,,1)
Line 445 of ViewableData.php
ViewableData->XML_val(SiteTreeFilterDateField,,1)
Line 102 of .cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.Includes.CMSMain_left.ss
include(C:\WINDOWS\Temp\silverstripe-cacheE--websites-_SilverStripe-Reception-Screen.v2.4\.cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.Includes.CMSMain_left.ss)
Line 392 of SSViewer.php
SSViewer->process(CMSMain)
Line 342 of ViewableData.php
ViewableData->renderWith(Array)
Line 483 of LeftAndMain.php
LeftAndMain->Left()
Line 369 of ViewableData.php
ViewableData->obj(Left,,,1)
Line 445 of ViewableData.php
ViewableData->XML_val(Left,,1)
Line 59 of .cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.LeftAndMain.ss
include(C:\WINDOWS\Temp\silverstripe-cacheE--websites-_SilverStripe-Reception-Screen.v2.4\.cacheE..websites._SilverStripe.Reception-Screen.v2.4.cms.templates.LeftAndMain.ss)
Line 392 of SSViewer.php
SSViewer->process(CMSMain)
Line 202 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 134 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 283 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 127 of Director.php
Director::direct(admin/)
Line 127 of main.php

Avatar
atticusservices

Community Member, 10 Posts

25 May 2010 at 6:26pm

Not sure why, but it is still trying to write to "/temp/" which doesn't exist. Do you have permissions set for PHP to write to the directory you are setting?

"Zend_Cache_Backend_File->setCacheDir(/temp/)"

Avatar
yurigoul

Community Member, 202 Posts

25 May 2010 at 6:49pm

BTW: a fix is set for 2.4.1

http://open.silverstripe.org/ticket/5349