keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

1.6 - open_basedir Bug? #175

Closed tobias992 closed 3 years ago

tobias992 commented 3 years ago

Hi, since version 1.6 i get this open_basedir entry in server error.log:

PHP Warning: is_dir(): open_basedir restriction in effect. File(/home/domainxxx/html/docs/wp-content/cache/cache-enabler/domainxxx.de/https-index.html/) is not within the allowed path(s): (/home/domainxxx/html/) in /home/domainxxx/html/docs/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 254PHP message: PHP Warning: is_dir(): open_basedir restriction in effect. File(/home/domainxxx/html/docs/wp-content/cache/cache-enabler/domainxxx.de/https-index.html.br/) is not within the allowed path(s): (/home/domainxxx/html/) in /home/domainxxx/html/docs/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 254PHP message: PHP Warning: is_dir(): open_basedir restriction in effect. File(/home/domainxxx/html/docs/wp-content/cache/cache-enabler/domainxxx.de/https-index.html.gz/) is not within the allowed path(s): (/home/domainxxx/html/) in /home/domainxxx/html/docs/wp-content/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 254"

I use nginx custom config to optimize performance. I also create the ".br" version with my server scripts with correct file rules. Looks like this entry in error.log is only set when i clear the Cache.

coreykn commented 3 years ago

Can you please check your open_basedir restrictions in your PHP configuration file?

tobias992 commented 3 years ago

Yes of course.

Is set to: /home/domainxxx/html/

coreykn commented 3 years ago

I apologize if I wasn't clear. I understood your current allowed path from the error message above. I meant you'll need to check and update your restrictions to resolve this error as it's not caused by Cache Enabler itself, rather the plugin is now checking if the directory exists before trying to clear it but restrictions on your server aren't allowing that to be completed.

The fix would depend on your preference. You can update the allowed paths or even set it to none. The open_basedir directive documentation linked above contains more information about this. Alternately, a simple web search with your specifications should point you towards other solutions.