How to Disable APC Cache via .htaccess

When it comes to fast loading, we need to know that caches are a great operation, helping us bring better client experience. So far, so good, but you should also know that there could be a problem when you count to mush on this operations - making some PHP or JS process wait or sleep. If you want to disable your APC Caching, you can follow our easy to do steps:

  • Login to your account through FTP or cPanel's file manager
  • Navigate to your domains "/public_html" directory
  • Locate your .htaccess file and open it in a text editor, or download the file to edit on your local computer using text-editor.
  • Add the following line to the .htaccess file:
  • php_flag apc.cache_by_default Off
  • Save the .htaccess file, and re-upload it to your "/public_html" if you edited locally.

You can also clear your cached memory on cPanel server

Any memory cached on Linux OS machines is being run on by default, and that's why this OS has very efficient memory management process. Of course there are some issues you should consider while using it. Frequently the Linux OS may at times decide that the Cached memory is being used and in this point is needed, which can lead to memory related issues. Think of this as well.

We give you few commands that will clear your cached memory on cPanel server.  

First you need to do is to flush your cache memory with:

root@server [~]# echo 1 > /proc/sys/vm/drop_caches

This will remove cached memory on every hour. The cron job will read and run this command. The result is clearing any built up memory cache.

You should also create a file in order to clear the cache memory. For example:

vi /root/clearcache.sh

After that, you need to paste the following commands as well:

#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches

The last step is to save and add this script in your cron job:

0 * * * * /root/clearcache.sh

The job is done. The result: the script you have created will remove cached memory automatically after every hour.
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

reCapcha doesn't work on my WordPress site. How to fix it?

Question: I have some issues with my reCapcha on my WordPress site, how to fix it. It was just...

Is it possible to get a dedicated IP address for my webpage?

Question: Hello, Is it possible to get a dedicated IP address for my webpage? (I am planning to...

Problem with PHP WordPress memory

Question: I'm trying to increase the php memory limit to 128Mb in order to keep Woocommerce...

Ad banner module does not work in my host

Question: I installed an ad banner module, but gave me the following message:ForbiddenAccess to...

I can't access to my WP installation

Question: After copying the new site files to de main directory, I can not login into my...