Do we need to restart apache + APC after deploying a new version of the application?

when we deploy our application, we simply create a new folder and point to it with a symbolic link, so apache will always find its way to the last build.

However, we get strange errors when deploying and continuing testing without first rebooting the apache server. We also have APC work and there is a feeling that caching has something to do with it.

Is it normal that restarting Apache is necessary when deploying a new version of our php application when APC is active? Or is there a better way, for example. flushing APC cache using shell script?

+4
source share
3 answers

You can use apc_clear_cache() .

See related questions:

How to clear APC cache entries?

How to clear APC cache without Apache crashes?

+7
source

depends on whether the apc.stat parameter is set to php.ini On or Off. If off (Typical for a production site), you need to clear the code cache or restart apache; if "on", then it should automatically select a new code

+6
source

Typically, APC will β€œstatize” each PHP file to see if it has changed since the last caching. Therefore, restarting Apache is not required for all application updates.

BUT, if your application uses apc_store () to store application data in the cache, and some of this data may change after the upgrade, restarting Apache is an easy way to clear the entire APC cache.

I believe apache2ctl graceful will work too.

In addition, APC works a little better if you disable the "stat" check; therefore, if you disable this feature, you will still want to restart Apache.

0
source

Source: https://habr.com/ru/post/1314253/


All Articles