New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, How can use PHP code to clear fastcgi_cache file?? #49
Comments
Just send an HTTP request to the correct URL using |
Here someone did a PHP script that, using URL, re-build the cache filename to delete it (selective purge). EDIT: here we can see
I'm trying to match something EDIT 2: i'm not able to build the correct cache filepath/filename using the linked script. I contacted the author to know more about how and where he found the filepath build pattern. You can see my last comment on the digitalocean post. EDIT3: on typical purge system, the parameter (url) sended to the purge is build like Some test i made : http://img4.hostingpics.net/pics/827481fastcgifilenamecache.png For now, it seem that building the cache filepath/name using MD5 value of the Achieving the right cache file delete from PHP would more lot more efficient than curl-ing the cache purge URL location i think. |
Hi @mtx-z, I'm the author of that article, I've replied to your comment. Are you adding the slash at the end of the domain when doing a
|
Hi, thanks for answering. Actually I'm not using the script with a curl, I want to use it directly from some php script. Have you looked at the screenshot I made? I set the cache key as header to then pass it in your script (just for test) in a sandbox but it 'ever match the name. From the cache key, I tried removing the last slash, add it, remove some part... To pass the string to your script but never matched the actual cache file name and path. I also tried using all your script with a full URL, and just from the $hash variable creation with the cache key directly. I wasn't able to find any code from fastcgi module from where the filename and filepath are builded. Have you? Thx a lot. Ps: when solved or' or, I'll make a full report on your post. |
Yes I checked those screenshots, there is "www.domain.com" in the PHP script but during the actual testing some real domain (censored)? |
Yes domain was hided (censored for sharing it) . I can give you full url by email if you want. |
Can you send it using this contact form? Also send me your Nginx virtual host file. |
Sure. But as you, I'm not using a cache purge location. |
Thanks a lot @jesinwp. The PHP script you made work perfectly. Error was entierly mine: resetting the cache_key further in the config file, so not the same as the builded one... This also resolve the issue @nottellyou ! |
@mtx-z great ! Share the code and close the ticket ! |
Here is the PHP code to delete the file cache related to the given URL.
|
hi, @mtx-z I tried server times , but failed. server
} Do you know why??? |
Hey @nottellyou Sorry for the huuge delay. On this screen, there is a capture of my cache folder (along with nginx conf). |
Hi, How can use PHP code to clear fastcgi_cache file??
The text was updated successfully, but these errors were encountered: