We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE2: difference between cache_path and cachedir

How Do I?

chris thacker's avatar
chris thacker
112 posts
9 years ago
chris thacker's avatar chris thacker

I’m troubleshooting a problem with a plugin and noticed that my database.php cachedir looks a little goofy. Note that I’m using IIS (win 2012).

Does this look right? The double slashes and combo of forward and backwards slashes looks wrong.

$db['expressionengine']['cachedir'] = "D:\\web\\abc\\system/expressionengine/cache/db_cache/";

Also, what is the difference between these two cache settings?

database.php $db[‘expressionengine’][‘cachedir’] = “path”;

config.php $config[‘cache_path’] = “”;

If I look in this folder, I do see some files in it that get modified when I log into the EE control panel (current_version & software_registration).

D:\web\abc\system\expressionengine\cache

I don’t see a db_cache directory though like my cachedir path is set for.

       
chris thacker's avatar
chris thacker
112 posts
about 9 years ago
chris thacker's avatar chris thacker

Can someone at Ellislabs reply please?

       
Seth Barber's avatar
Seth Barber
172 posts
about 9 years ago
Seth Barber's avatar Seth Barber

Hi Chris,

2.x has a separate cache for the database, distinct from the general purpose cache directory. As for your path setting for the cachedir, I would convert it to use either forward slashes or backslashes. The backslashes are doubled up because of how PHP handles the \ character in strings.

       
chris thacker's avatar
chris thacker
112 posts
about 9 years ago
chris thacker's avatar chris thacker

Hi Seth,

As far as the $db[‘expressionengine’][‘cachedir’] path, when I install a fresh copy of EE 2.11.1 it auto creates this path, based on the system folder name I presume, and it’s adding the double and mixed slashes.

Is this a bug with EE on Windows? Will it work anyway configured like this?? How can I test it to tell that it’s functioning as intended?

I tried it with all double forward slashes // and the EE CP still loads.

I tried it with all double back slashes \ and the EE CP still loads.

… as well as the way EE creates originally.

However I never see a /db_cache folder created so I don’t know if it’s truly working beyond the site loading.

Thanks, Chris

       
Seth Barber's avatar
Seth Barber
172 posts
about 9 years ago
Seth Barber's avatar Seth Barber

Hi Chris,

The funny thing about the db_cache folder, it’s not used unless CodeIgniter’s cache setting is turned on. CI’s database drivers need a value for that path, but we never use their caching. So…that’s not a config value that is really being used and in fact we dropped it entirely for 3.x.

       
chris thacker's avatar
chris thacker
112 posts
about 9 years ago
chris thacker's avatar chris thacker

Ah, interesting. If it’s set incorrectly though it will cause EE to not load. I think I tried it with single slashes and it broke EE.

       
Seth Barber's avatar
Seth Barber
172 posts
about 9 years ago
Seth Barber's avatar Seth Barber

Odd. I’ve been fiddling with that config and haven’t seen a problem yet. What kind of errors and/or broken behavior were you experiencing?

       
chris thacker's avatar
chris thacker
112 posts
about 9 years ago
chris thacker's avatar chris thacker

From my testing on a Windows 2012r2 server running IIS 8.5.

Fails with http error 500, EE CP doesn’t load: $db[‘expressionengine’][‘cachedir’] =

'D:\wwwdata\eetestsite\system\expressionengine\cache\db_cache\'; (single backwards)

Works:

$db['expressionengine']['cachedir'] = 'D:\wwwdata\eetestsite\system/expressionengine/cache/db_cache/'; (mixed single)
$db['expressionengine']['cachedir'] = 'D:/wwwdata/eetestsite/system/expressionengine/cache/db_cache/'; (single forward)
$db['expressionengine']['cachedir'] = 'D:\\wwwdata\\eetestsite\\system\\expressionengine\\cache\\db_cache\\'; (double backwards)
$db['expressionengine']['cachedir'] = 'D://wwwdata//eetestsite//system//expressionengine//cache/db_cache//'; (double forward)
$db['expressionengine']['cachedir'] = 'D:\\wwwdata\\eetestsite\\system/expressionengine/cache/db_cache/'; (mixed, EE default)
       
Seth Barber's avatar
Seth Barber
172 posts
about 9 years ago
Seth Barber's avatar Seth Barber

Ah! PHP sees that last \' as a single escaped character rather than two separate characters. Thus the string is not yet closed and the 500 error will occur.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.