• Resolved Andrew789123

    (@andrew789123)


    Hi I am setting up a new wordpress site on Amazon AWS

    I followed the following blog post:
    https://aws.amazon.com/blogs/networking-and-content-delivery/accelerating-wordpress-with-cloudfront-using-the-aws-for-wordpress-plugin/

    I had everything set up with CloudFront on www, also working with HSTS headers, using the AWS for WordPress plugin.

    I am now trying to advance my set up by adding further caching and am using W3 Total Cache for that using guidelines from the whitepaper: https://d1.awsstatic.com/whitepapers/wordpress-best-practices-on-aws.pdf

    On page 25 it states that I should enable origin push CloudFront inside W3 Total Cache, after doing that I am getting 500 errors on every page.

    For example:
    Got error ‘PHP message: PHP Fatal error: Cannot redeclare A
    ws\\parse_ini_file() (previously declared in /opt/bitnami/apps/wordpress/htdocs/wp-content
    /plugins/amazon-polly/vendor/aws/aws-sdk-php/src/functions.php:410) in /opt/bitnami/apps/w
    ordpress/htdocs/wp-content/plugins/w3-total-cache/lib/Aws/Aws/functions.php on line 401’,

    Can anyone help with the configration for this? I would ideally like to get the static assets stored in S3.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @andrew789123

    Thank you for your inquiry and I am happy to assist you with this.
    As you can see the problem is that both W3 Total Cache and the other plugin that you are using are losing the same library.
    This means that you are already using the AWS SDK library, and using W3 Total Cache CDN is causing the conflict.
    We tried to limit the number of requests when W3 Total cache loads the AWS library and it happens only when interactions with AWS are required. If the other plugin does the same and will not load it always – potentially both products will be able to co-exist.
    Another option is to force both projects to use the same AWS library code.
    You should include AWS separately, and force W3TC not to load its own copy by adding
    define('W3TC_SKIPLIB_AWS', true);, and the other plugin using the AWS library should do the same.
    This is not a solution but a way to make things work. The solution is in the first part meaning the other plugin should limit the number of requests with AWS library.
    Or simply you should just only use W3 Total Cache for AWS CDN.
    Thank you!

    Thread Starter Andrew789123

    (@andrew789123)

    Ah I see it is due to the library.

    I disabled the other plugin because I don’t think I need it at the moment, but I will be sure to use the define('W3TC_SKIPLIB_AWS', true); code if I need to.

    I think I have S3 and CloudFront setup now… is there a way to test this?
    If I add new files do I need to manually press the upload button or is it automatic?

    Also I had to make the bucket public access in order to stop 403 errors, is this normal?

    Anything else I need to know for this configuration?

    Thanks

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @andrew789123

    YOu can test this with the test button in Performance>CDN, near the bucket option.
    Yes, you need the public access for the bucket.
    This should be automatic but you can invalidate new individual files with the manual purge button in the Performance>CDN just above the General box.
    If the files have the AWS URL it means that it works as expected.
    Thanks!

    The work-around I used is below:

    Deactivate w3-total-cache plugin (DO NOT Enable CloudFront CDN in w3-total-cache when starting).

    Install, configure, test and deploy CloudFront using AWS For WordPress Plugin
    https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WordPressPlugIn.html

    After successfully deploying AWS CloudFront, Deactivate AWS For WordPress Plugin.

    Activate w3-total-cache using the CloudFront settings that were used for AWS For WordPress Plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘W3 Total Cache Amazon CloudFront Configuration’ is closed to new replies.