PHPSocialNetwork / phpfastcache

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
https://www.phpfastcache.com
MIT License
2.36k stars 452 forks source link

Config('path') - Can't declare path from the parent directory of index file directory. #890

Closed Irakli-GZ closed 1 year ago

Irakli-GZ commented 1 year ago

What type of issue is this?

Incorrect/unexpected/unexplainable behavior

Operating system + version

Windows 10

PHP version

8.1.12

Connector/Database version (if applicable)

No response

Phpfastcache version

9.1.2 ✅

Describe the issue you're facing

So... I'm using .htaccess configs to access the root directories. I have a specific folder "Index" for index.php, from where the execution starts, and I have a "Storage" dir next to the "Index" dir to store data files... and I want to land caching in "Storage" dir ... so I've tried pretty much everything, including checking my .htaccess configs, which didn't seem to affect anything at all, and I think it somehow can't be done to detect the '../' and escape from the index dir . ...

Thanks.

Expected behavior

No response

Code sample (optional)

No response

Suggestion to fix the issue (optional)

No response

References (optional)

No response

Do you have anything more you want to share? (optional)

No response

Have you searched in our Wiki before posting ?

github-actions[bot] commented 1 year ago

Hello curious contributor ! Since it seems to be your first contribution, make sure that you've been:

Geolim4 commented 1 year ago

Hello,

How did you setup the config of Phpfastcache exactly ?

You can customize the cache path as you want, just read the Wiki.

Irakli-GZ commented 1 year ago
$config = new Phpfastcache\Config\ConfigurationOption([
                'path' => '../Storage/Cache',
                'preventCacheSlams' => true,
                'cacheSlamsTimeout' => 20
            ]);

\Phpfastcache\CacheManager::setDefaultConfig($config);
Geolim4 commented 1 year ago

Don't use a relative path, use an absolute path.

Irakli-GZ commented 1 year ago

Yes, I tried, it worked. But did not work in this system. The problem was that my .htaccess config was preventing unwanted access from outside of the system in to the target dir with absolute url path.. so... I inserted DOCUMENT_ROOT path and it's fine.

Thanks.

Geolim4 commented 1 year ago

Ok, have a nice day :)