Support » Plugin: Super Page Cache for Cloudflare » v4.5 and file_put_contents of ngnxi.conf

  • Vinnie

    (@nemovrusso)


    I have my site hosted on platform.sh – the plugins directory there is not writable. The latest version 4.5 changes something and causes the following to happen:

    Warning: file_put_contents(/app/wordpress/wp-content/wp-cloudflare-super-page-cache/www.mysite.com/nginx.conf): failed to open stream: No such file or directory in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php on line 1116
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 532
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 533
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 534
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 590
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 591
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 592
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 593
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 594
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 595
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 596
    
    Warning: Cannot modify header information - headers already sent by (output started at /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:1116) in /app/wordpress/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.class.php on line 597

    I am guessing it’s because of the file_put_contents that’s failing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @nemovrusso,
    the plugin needs to have write access to the folder it creates inside wp-content, to be more specific /wp-content/wp-cloudflare-super-page-cache/.

    If it doesn’t have write access then even the fallback cache, purge HTML pages only etc. will also not work.

    In v4.5 if you are using a nginx server, the plugin will automatically create a nginx.conf file inside /wp-content/wp-cloudflare-super-page-cache/<your-domain>/ which you can just easily include inside your server’s main nginx.conf file.

    In this way, you don’t have to manually copy-paste the Nginx configs which often leads to issues (as you might forget to copy some stuff or miss some strings). All the plugin file creation operations are restricted to that folder contents only. Not sure why that is not writable.

    I really don’t see this error on any of my sites & client sites that are running on nginx server. Also the log you attached it says No such file or directory which I have no idea why. Can you check your site using your FTP is the folder and contents inside it exists properly or not?

    Thread Starter Vinnie

    (@nemovrusso)

    Thanks for your answer @isaumya.

    My sites are deployed on https://platform.sh which is a container based platform, with modern deployment.

    That means the filesystem where the codebase as a whole resides is read-only once the build process is finished, for security reasons. This modern way of doing things should really start becoming something plugin developers take into consideration.

    Anyway, for now I’d be happy if the plugin failed gracefully.

    Re the file not existing, I am guessing it’s the first time is trying to create that file (wasn’t doing it on older versions), and it’s of course failing own a read only file system. Even if the file existed, it would still be failing, because the file system is RO.

    Thanks.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @nemovrusso,

    This modern way of doing things should really start becoming something plugin developers take into consideration.

    – That is never gonna be a possibility for plugins like these which needs to create temporary files internally for many features to work. Adding everything in database simply means a much slower system as DB queries can take much longer especially for a larger site.

    Also if the system is read-only then uploading stuff via media uploader should also fail among many other things.

    Thread Starter Vinnie

    (@nemovrusso)

    You can have a look here if you are interested. I could technically create a writable mount just for the plugin. But I’d rather not.

    I really don’t want to argue about the rest of the points.

    All I am saying, it’d be nice if the plugin failed gracefully.

    Thanks for your time 🙂

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @nemovrusso,
    Inside your yaml file I see you mentioned the path wordpress/wp-content/plugins/wp-cloudflare-page-cache. You also need to take care of the path wordpress/wp-content/wp-cloudflare-page-cache/<yourdomain>/ as that’s the folder where the plugin does all of it’s writing like you are handling the wordpress/wp-content/cache path.

    Thread Starter Vinnie

    (@nemovrusso)

    You’re right, that’s the one I intended to put in to begin with, but made a mistake. Thanks for catching it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘v4.5 and file_put_contents of ngnxi.conf’ is closed to new replies.