PHP files do not show the changes

If you are on a VPS or Dedicated server and you cannot see the changes to your PHP files when you update them, it is most likely caused by APC on your server or caching in your CMS (Content Management System) software. If you are using caching in your CMS you will need to consult the CMS develper on how to clear the CMS cache..

If you have APC installed on your server, you will need to wait the “TTL” time to see any changes to your PHP files. By default, the “TTL” settings are set to 1800 which is 30 minutes until the cache is refreshed. You can download the source code at the following link.

Viewing your APC cache settings

You can check the server APC php.ini settings by accessing your server using shell and running the following command:

grep apc /usr/local/lib/php.ini

When we setup APC on VPS and Dedicated servers, we use the following settings in the system php.ini:

[APC] extension=apc.so apc.enabled=1 apc.stat=0 ; set to 0 for a production site, 1 for development, will check files for recent updates apc.shm_segments=1 ; dependant on hardware apc.shm_size=32M ; dependant on hardware, 64M and above safe on dedicated servers apc.ttl=1800 apc.user_ttl=1800 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.rfc1867 = 1 apc.filters = w3-total-cache-config

Here the apc.ttl=1800 is set to the 1800 or a 30 minute expire time. You can either wait for the time to elapse for the caching or you can clear your server cache.

Using apc.php to clear your server cache

You can use the existing apc.php file by copying it to your public_html directory. This gives you an interface where you can clear your APC cache from the server.

Copying your apc.php from your server.

The APC software comes with a dashboard where you can view and clear the current cache files. You will need to move the apc.php file to a public location so you can view it in your browser. Below are the steps the copy the apc.php file to a public location.

cp -p /usr/src/apc.php ~USER/public_html/ chown USER:USER ~USER/public_html/

Modify the file to add the user/pass to login on the page.

nano ~USER/public_html/

Make up a user and pass to login on the apc.php page. Then you will need to go to the location of the file in your site files. For example the url looks like the following.

https://example.com/apc.php

You can then see more details and clear the cache.

Downloading an acp.php file online

If the apc.php file does not exist, the source code for the apc.php is found at the following URL.

https://pecl.php.net/get/APC

Make up a user and pass to login in the apc.php page code. Then you will need to go to the location of the file in your site files. For example the url looks like the following.

https://example.com/apc.php

You will have a login page where you can log in and clear your APC cache.

If for whatever reason you cannot access the apc.php file or it is not working, please contact tech support and we can look into clearing the cache for you.

Was this article helpful? Join the conversation!