暂时禁用 apc.stat = 0
我的 apc.stat = 0,因此每次进行更改时都需要删除 APC 缓存。
假设今天我知道我正在做一些更改,有没有办法临时(例如 24 小时)对 php(也许使用 SSH)设置 apc.stat = 1,而不更改 php.ini?
I have apc.stat = 0, so every time I make a change I need to delete the APC cache.
Let's say today I know I am making some changes, is there a way to temporarly (24 hours for example) say to php (maybe with SSH) to set apc.stat = 1, without changing php.ini?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以创建一个以 root 身份运行的 cron 作业。它必须将
apc.stat = 0
的 php.ini 版本复制到 PHP 目录中,然后重新启动 Web 服务器。You could create a cron job that runs as root. It would have to copy a php.ini version with
apc.stat = 0
over into the PHP directory, and restart the web server.如果您要将更改部署到生产服务器,
首先,您应该在更改到达时清除 apc 缓存。
换句话说,您可以将clear apc stat 命令放入部署脚本中。
如果您始终直接将更改上传/scp 到生产服务器,
嗯……是时候改变了!
您可以使用简单的 shell 脚本来包含 scp(rsync、git、svn 导出...等)
命令与 apc statclear 命令一起使用。
准备好部署脚本后,
您甚至不必担心何时更改 apc.stat。
If you are to deploy changes to production server,
at the first place, you should always clear the apc cache upon changes arrived.
In another words, you can put the clear apc stat command into a deployment script.
If you are always directly upload/scp the changes into production servers,
hmmm ... is time for a change!
You can use a simple shell script to include the scp (rsync, git, svn export ...etc)
command together with this apc stat clear command.
Once you have the deployment script ready,
you don't even have to worry about when to change apc.stat.