• We’re running Mod Apache and when setting up WP Super Cache we’d usually chown wp-config.php and wp-content/ to the user that apache runs as.

    Upon installation WP Super Cache would modify the wp-config.php file and create advanced-cache.php, wp-cache-config.php and cache/ within the wp-content/ directory.

    Once this was done we would chown wp-config.php and wp-content/ back to the regular user and that was the end of it. WP Super Cache would still be able to modify its own files that it created since they remained owned by the apache user.

    However, it seems recently WP Super Cache is now attempting create a temporary file before overwriting one of its own files that it needs to change. This means it’s no longer sufficient for wp-cache-config.php to be owned by apache, the entire wp-content/ directory needs to be owned by apache (which is more of a security risk).

    Without this it’s no longer possible to make changes to WP Super Cache via the WordPress Admin and it results in lots of errors being logged like the one below:

    Warning: fopen(/var/www/vhtdocs/xxx/public/wp-content/570831995.php): failed to open stream: Permission denied in /var/www/vhtdocs/xxx/public/wp-content/plugins/wp-super-cache/wp-cache.php on line 2232

Viewing 3 replies - 1 through 3 (of 3 total)
  • Same problem here. Is there any fix?

    Same problem. Any Fixes?

    Allowed the permissions temporarily to allow turning caching on/off, but after write permissions for wp-content are turned off caching cannot be turned on/off again. Throws errors about failing to open file stream.

    @jreade and I were looking at this today and seem to have discovered the problem. For some reason when Super Cache is trying to write a new wp-cache-config.php it tries to create the new file in the same directory (wp-content) rather than creating it in the system registered temp directory. We have our site locked down so we don’t allow writing except in places its required. We allow writing to the actual caching directory as well as to the wp-cache-config.php file itself.

    The fix is simple, change line 1072 from:

    $tmp_file = dirname( $my_file ) . '/' . mt_rand() . '.php';

    to:

    $tmp_file = sys_get_temp_dir() . '/' . mt_rand() . '.php';

    Aaron

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Issue with permissions, attempting to create temporary config file’ is closed to new replies.