I have two domains, one is main domain and second one is subdomain. I need to share one tmp folder between both of them. In core.php i did like this define('CACHE_DIR', TMP.'cache'.DS.$_SERVER['SERVER_NAME']); and Cache::config('default', array('engine' => 'File', 'path' => ROOT.DS.'tmp'.DS)); , but its not working. Please if anybody knows about this issue, help me?
Thanks!
I have two domains, one is main domain and second one is subdomain. I
Share
The TMP constant will be defined to be within the app-directory of the subdomain so you’ll end up saving the files whitin
The TMP constant is defined inside bootstrap.php, but you can override it by defining it yourself inside your index.php
If you set the TMP to the right location, all temp, session and cache files will be written to that location. So consider it is a problem if session-data is stored in the shared directory
important
Be sure to set a different cache $prefix for each website. Otherwise Models cached for one website will also be used by the other website, which may cause data from the wrong database to be used!! This variable can be set inside your app/Config/core.php
important2
I would strongly advise you to not use the
$_SERVER['SERVER_NAME']variable. If your website uses serverAliases (e.g. both handles http://www.example.com and example.com) then a separate cache-directory will be used for both (sub)domains. It’s best to set a fixed path.