Comments (14)
If it helps you, this the current way i initialize the files cache ( i am on V8 )
self::$file = \Phpfastcache\CacheManager::getInstance('files',new \Phpfastcache\Drivers\Files\Config([
'path' => sys_get_temp_dir(),
'itemDetailedDate' => false,
'htaccess' => false,
'securityKey'=> 'YOUR_KEY_HERE',
]));
from phpfastcache.
Hello curious contributor !
Since it seems to be your first contribution, make sure that you've been:
- Reading and searching out our WIKI
- Reading and agreed with our Code Of Conduct
- Reading and understood our Coding Guideline
- Reading our README
If everything looks unclear to you, tell us what π
The Phpfastcache Team
from phpfastcache.
Hello,
Use securityKey for that:
from phpfastcache.
First of all, thank you for the quick response, I appreciate that! I have included the securityKey to the ConfigurationOption object. I will wait for the next cron run and let you know if it works. Thanks again.
from phpfastcache.
I get the following error:
Message: 'Invalid option(s) for the config Phpfastcache\Config\ConfigurationOption: securityKey'
I use version 8.1 of PHP Fast Cache. If I look in lib\Phpfastcache\Config\ConfigurationOption.php I don't see the property securityKey. How to solve?
from phpfastcache.
It's because you used the wrong Configuration class (the generic one) x)
Use IOConfigurationOption
of Phpfastcache\Drivers\Files\Config
instead.
from phpfastcache.
Thank you again. I only have a trait class IOConfigurationOptionTrait
. How to use this i.c.m. with the generic ConfigurationOption
class? I want to set the properties: path and securityKey.
from phpfastcache.
Thank you! I will try it and post an update ASAP.
from phpfastcache.
Looks like it works, thank you! However, I now get a permission related error in the cron.log:
Warning: fopen([cache_dir]/Files/11/9d/119d86aff6cd70dcd16a047b72440cb2.txt): failed to open stream: Permission denied in [app_root]/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php on line 355
It only seems to go wrong for specific cached files, not for all files. Permissions for the folders are correct from what I can see. Any suggestions or tips how to debug and solve this? I'm struggling because it seems to only occur occassionally.
from phpfastcache.
from phpfastcache.
Yes, probably you run it as a different user from cli than the web server
eg
cron runs as localUser
web is www-data
after you set the correct permissions on your tmp folder,
your cron should look something like this
Replace with your required user
sudo crontab -e -u www-data
SHELL=/bin/bash
0-58/2 * * * * /bin/echo 'CRON: tick' $(whoami) $(date) > /tmp/cron.www-data.tick.log 2>&1
1-59/2 * * * * /bin/echo 'CRON: tock' $(whoami) $(date) > /tmp/cron.www-data.tock.log 2>&1
from phpfastcache.
Yes, probably you run it as a different user from cli than the web server
eg cron runs as
localUser
web iswww-data
after you set the correct permissions on your tmp folder, your cron should look something like this
Replace with your required user
sudo crontab -e -u www-data
SHELL=/bin/bash 0-58/2 * * * * /bin/echo 'CRON: tick' $(whoami) $(date) > /tmp/cron.www-data.tick.log 2>&1 1-59/2 * * * * /bin/echo 'CRON: tock' $(whoami) $(date) > /tmp/cron.www-data.tock.log 2>&1
Thank you, I will try this if I encounter the issue again. As I said, the issue seems to occur occasionally and I don't see it in the latest log.
A last question regarding the www-data
crontab: thank you for the clear explanation. Does this solution affect my current crontab setup? Is it possible to run a cron task inside the current crontab
(localUser) and switch there to the www-data
user? I want to be sure that I'm not changing anything that I can't revert :)
from phpfastcache.
Personally i avoid switching users in crontab. But in case you want to, and the user has permission and you setup your sudoers correctly try something like this
* * * * * sudo su www-data -s /bin/bash -c 'cd /folder && php index.php' >> /tmp/cron.www-data.log 2>&1
crontab -e
-> edit current user's crontab
crontab -e -u XXX
-> edit XXX's crontab
Why bother switching users inside crontab?
from phpfastcache.
Hello !
I'm closing this issue since the crontab configuration is out of phpfastcache's scope :)
Have a nice day !
from phpfastcache.
Related Issues (20)
- Website broken - Unable to browse any documentation page HOT 6
- PDO Cache is case insensitive? HOT 4
- Memcached driver compress_data cache miss HOT 4
- Config('path') - Can't declare path from the parent directory of index file directory. HOT 6
- Installation fails: 'Fatal error: Uncaught Error: Class "CacheManager" not found ...' HOT 3
- getItemsByTag() - empty after one item has expired HOT 10
- CanΒ΄t retrieve phpfastcache 9.1.3 thru composer HOT 7
- Saving an item that is already in the pool after its expiration time fails HOT 13
- 2 million data cache? HOT 5
- Storing and retrieving mysql result arrays using Psr16Adapter HOT 4
- Deleting cache by tag without loading all its cache HOT 3
- cache not clearing manually in html HOT 2
- Disable 'securityKey' and adapter directory. HOT 9
- Cache clear() not working with Redis, getItem() still returns data HOT 2
- How to use memcache on v8 ? HOT 3
- Support custom native RedisCluster client HOT 9
- TypeError Phpfastcache\Drivers\Files\Driver::driverRead(): Return value must be of type ?array, bool returned HOT 13
- Memory size exhausted by deleting by Tags HOT 10
- Save - Inside workerman event threads Save() throws fopen() error HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpfastcache.