简体   繁体   English

我们是否需要在应用程序的新版本部署后重新启动apache + APC?

[英]do we need to restart apache + APC after new version deployment of app?

when we deploy our app, we simply create a new folder and point a symbolic link to it, so apache will always find its way to the latest build. 当我们部署我们的应用程序时,我们只需创建一个新文件夹并指向它的符号链接,因此apache将始终找到最新版本的方式。

However, we get strange errors when we deploy and continue testing without first rebooting the apache server. 但是,当我们部署并继续测试而没有首先重新启动Apache服务器时,我们会遇到奇怪的错误。 We also have APC running and have a feeling that caching has something to do with this. 我们也有APC运行,并且感觉缓存与此有关。

Is it normal that an apache restart is required when deploying a new version of our php application when APC is active? 在APC处于活动状态时部署新版本的php应用程序时,是否需要重新启动apache是​​否正常? Or is there a better way, eg clearing the APC cache using a shell script? 或者有更好的方法,例如使用shell脚本清除APC缓存?

You can use apc_clear_cache() . 您可以使用apc_clear_cache()

See related questions: 查看相关问题:

How to clear APC cache entries? 如何清除APC缓存条目?

How to clear APC cache without crashing Apache? 如何在不崩溃Apache的情况下清除APC缓存?

depends if you have the apc.stat setting in php.ini On or Off. 取决于你是否在php.ini中打开或关闭apc.stat设置。 If Off (typical for a production site) then you need to clear the code cache or restart apache; 如果为Off(典型的生产站点),则需要清除代码缓存或重启apache; if On, then it should pick up the new code automatically 如果打开,那么它应该自动获取新代码

Normally, APC will 'stat' each PHP file to see if it has been changed since it was last cached. 通常,APC将“统计”每个PHP文件,以查看它自上次缓存以来是否已更改。 So restarting Apache is not required for all application upgrades. 因此,所有应用程序升级都不需要重新启动Apache。

BUT if your application uses apc_store() to store application data in the cache and some of that data might change after an upgrade, then restarting Apache is an easy way to flush the entire APC cache. 但是,如果您的应用程序使用apc_store()将应用程序数据存储在缓存中,并且某些数据在升级后可能会更改,那么重新启动Apache是​​一种简单的方法来刷新整个APC缓存。

I believe apache2ctl graceful would work, too. 我相信apache2ctl graceful也会起作用。

Also, APC performs a little better if you turn off the 'stat' checking; 此外,如果您关闭'stat'检查,APC会更好一些; so if you disable that feature, then you'll want to restart Apache anyway. 因此,如果您禁用该功能,那么您仍然需要重新启动Apache。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM