I created a clone of my live project and named it live_clone. Then I changed the database credentials in app/etc/env.php to my new live_clone database and imported the live database to it.

Then I opened the database with phpmyadmin and changed the BASE URL's to the live_clone domain.

I did this often and it always worked flawlessly.

Then I changed to deployment mode "production".

However, if I execute php bin/magento cache:flush on live_clone, then the cache is getting flushed for my live project instead of for the project live_clone. If I execute grunt clean on live_clone then users get redirected to live_clone instead of live!

What is going on?

  • 1
    where do you keep your cache? Redis/ files? – Diana Botean Feb 8 at 8:49
  • 1
    Good question! Yes, I am using Redis. It might still use the redis from live hmm – Black Feb 8 at 8:50

Please make sure that you are not using the Redis connection in app/etc/env.php cache key for both default and page_cache sub-keys.

  • Do you know if I can create a new Redis Database for live_clone? Or can I only use redis for the live project and I need to disable it for live_clone ? – Black Feb 8 at 9:02
  • 1
    ↑ I just changed the database numbers everywhere, now it seems to work! – Black Feb 8 at 9:06
  • 1
    Glad to hear this! Regarding your question, I would totally go with having separate redis instances. Why? because say you are debugging something and clear the cache directly using redis flushall - this command will flush all databases and you can accidentally clear the prod cache. you could theoretically use a diff database if you use only magento cache cleaning options, but i am not sure how this behaves when you use Flush Cache Storage button, (it doesn't care about tags, probably will delete your prod cache as well). – Diana Botean Feb 8 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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