2

I have got varnish installed on my server. I have a page on my site which i would like to get cached via Varnish. With fresh varnish installation, I created a PHP page with some content in it. loaded the page. Varnish worked fine.

But as I added session_start() on first line of that page, The varnish cache stopped working.

What is the problem with Varnish and PHP session ? Can anyone help

3

I suggest you read the Varnish Book http://book.varnish-software.com/4.0/

It explains how Varnish and HTTP caches work.

You cannot have a session and cache the content at the same time.
You could configure varnish to do so, but it would be a different cache per different user (session) which makes the whole caching useless (depending on the website).

| improve this answer | |
  • Above said link not working – user1844933 Jul 24 '17 at 18:02
  • I updated the link. – Cha0s Jul 25 '17 at 9:18

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.