0

I have a script like this

script.php

<?php
include "data/package.php";
echo $package[0]["name"];
echo "Hello World";
?>

and i do cache false with this

map $request_uri $cache_false {
    default 0;
    ~^/data/package.php?$ 1;
    ~^/signin.php?$ 1;
}
...
fastcgi_cache cache
fastcgi_cache_bypass $cache_false;
fastcgi_no_cache $cache_false;

and package.php use the session from signin.php page

signin.php

$_SESSION['package'] = 1;

package.php

$package = packages($_SESSION['package']);

I wanna cache the script.php while having the $package content change without getting cached because every user is different in his packages().

Does setting $cache_false = 1 for signin and package pages make include() content changed?

Do I only need to use javascript and add the content from the client only?.

1 Answer 1

0

nginx caches the full response of a URL. If you request https://www.example.com/script.php, nginx will pass the request to PHP-FPM which executes the script first time when accessing the URL.

nginx returns the cached content for subsequent requests.

So, if there is an include in script.php, it is executed the first time, and then it is not executed anymore, because script.php output is already in cache.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .