Cached files are stored on our server for quick access. This is only done with static resources, which do not change frequently. However, these cached resources can become outdated if the Cloudways Server has newer files.
This causes inconsistencies in how you view the website to that of other people viewing it or using another device/browser.
How do I clear my Cloudways cache? 2022– Step-by-Step Guide!
Why clear Cloudways cache?
When your content is no longer being updated on the server, it is safe to assume that you have a cached version of these resources. However, if you want to update the content or post new updates for existing posts, then you need to clear the Cloudways caches.
Cached files do not get automatically removed, and you may end up with outdated content that no longer reflects your site.
Also, if your server is not caching the right resources (which could be the case if you were recently transferred to Cloudways), then you need to clear the cached files before using our Managed Cloud Server.
When do I clear Cloudways’ cache?
If your web pages are loading slowly or take time to load, or if there are broken links on the website since yesterday evening at 7 PM, for example, it indicates incorrect/outdated resource caching in temporary directories.
Apart from this reason too, incorrect file cached may cause the website’s images to be missing; this could lead to serious issues where visitors believe that your website is unreliable.
In some cases, you may have made changes to your websites on a local server and wish to see how the site would look for other users on a live server without waiting till it is published online. In this case, too, you need to clear the Cloudways cache.
How To Clear Cloudways’ cache?
There are two ways to clear your Cloudways cache: through SSH and via cPanel. If you want to use shell access in cPanel, follow these steps:
Log in to the Cloudways panel and navigate to Servers > SSH access. Make sure you are using the server that has the cache issue, then click Edit next to Shell access.
If you do not want any distractions, check to Hide this menu from all users except administrators only. Otherwise, leave it as a display for everyone.
Enter your Username under SSH username, Password under SSH password, select Linux (default) under Public Keys Authentication Method, enter your Public key content under Public key content, if there is no need to use port 22 on your current machine, change the Port number to something else.
Then click Save. If you have added a public key successfully, there will be an Authenticated icon displayed right next to the button.
Now, navigate to the SSH terminal under Server management. You will see two input boxes there, one labeled as ‘PUT YOUR CURRENT SHELL HERE’ and the other one is for the path of the shell. Enter /bin/bash in both the input boxes and click Execute so that you can access your server with root privileges.
While on the server shell, enter /scripts/php -f cache_clear.php command so that all cached files are removed from Cloudways servers. This could take some time depending on how much data is stored in the caches of your website.
If you do not want to use SSH or cPanel, follow these steps:
Log into your FTP account using Filezilla or any other similar software.
Navigate to the public_html/cache folder and delete all the files there. Make sure you are using the right path for your FTP software because it can be something different than what I mentioned above.
If you do not want any distractions, make sure you check to Hide this menu from all users except administrators only. Otherwise, leave it as a display for everyone. If you have added a public key successfully, there will be an Authenticated icon displayed right next to the button.
After that visit Cloudways panel > Servers page > SSH access, where you will find two input boxes under Public Keys Authentication Method – one labeled as ‘PUT YOUR CURRENT SHELL HERE’ and the other one is for the path of the shell.
Enter the path of the shell you used in your FTP software to access the public_html/cache folder – for example, http://example.com/public_html/cache
If there are no cached files left on your server after you cleared the cache through one of these methods, all pages should load properly without any hiccups.
If this does not solve the problem, it probably means there is some issue with caching plugins, or Cloudways servers might have encountered some problems during updates.
Any other way to clear cache?
Cloudways has outlined two methods that you can follow. However, if there is a problem accessing your server via SSH or if you need to use FTP software, here are some suggestions for clearing your Cloudways Cache:
You can add .htaccess file in public_html/cache folder and add the following code in it: php_flag display_startup_errors off ; php_value memory_limit 0M ; php_value max_execution_time 0 ; php_flag log_errors on ; phpphpcs –report = full /home/ec2-user/public_html/cache/* | tee -a /tmp/phinglog > /dev/null
You can add php.ini file in public_html/cache folder and add the following code in it: memory_limit = 0M ; timeout = 0 ; max_execution_time = 0
Then run this command for clearing caches through SSH or cPanel: /scripts/php -f cache_clear.php –clear-all
Same error, different resolutions?
If you used one of these methods to clear your Cloudways Cache but the problem still persists, please contact Cloudways Customer Success Team by opening a ticket here.
Make sure you mention the details about what has been done so far and screenshots of errors that popped up if any.
Conclusion | How do I clear my Cloudways cache? 2022
I Hope, with the steps mentioned above, you are able to clear your Cloudways cache easily. If you still have doubts, you can write to us in the comments section. We shall be glad to help you in the best way possible.