我在我的服务器上安装了APC PHP.PHPinfo正在展示它.但是我得到一个问题,因为我有点困惑......
将来到服务器的新PHP请求将自动开始使用APC还是需要修改php代码才能使用APC?你能提供一些线索吗?
谢谢
如果 apc 存在,则会使用它。除非 的默认值为apc.enabledFalse,否则请在 phpinfo.php 中检查它。
如果启用的设置正常,第一个 apc 用法将是操作码。存储 php 脚本的“编译”版本。现在,通过打开 apc 的多个设置(例如避免在每次文件访问时检查源代码修改)可以大大增强此行为。
APC 中还有第二个重要功能,即将其用作应用程序的持久性/缓存存储。但是这些事情需要您的应用程序中的特定应用程序指令,就像您使用数据库一样。检查这些功能。
要真正激活 APC优化,您应该查看所有 APC 设置。apc.shm_size和apc.shm_segments对于检查 APC 内存大小的设置最有用,并且为所有 virtulahosts 共享。但在这些基本设置之后,您应该检查虚拟主机/应用程序(您将在其中使用 php_value 指令)或全局 php.ini 中的一些内容,这是生产配置的摘录:
请注意,您应该了解每个激活的设置并阅读文档,否则您将在开发中浪费时间,因为 php 不会读取您的源代码更改
# Activate apc
apc.enabled =1
# Optimisation of include/require_once calls
apc.include_once_override =1
# transform paths in absolute ones (no effect if apc.stat is not 0),
# files from stream wrappers (extended includes)
# won't be cached if this is activated as they cannot be used with php's realpath()
apc.canonicalize =1
# In production set it to 0, then file changes won't be observed before
# apache is restarted,
# significant boost, else file time is stated at each access (needed at 1 in dev)
apc.stat =0
# avoid problems with rsync or svn not modifying mtime but only ctime
# so if you're in production set this to 0, like for the previous one
apc.stat_ctime =0
# deprecated option: apc.optimization not available anymore
# apc.optimization =0
# inform apc on number of files of the application
apc.num_files_hint =2000
# inform apc on the number of cache variables
apc.user_entries_hint =100
# cache lifetime managmenent ----------------
# time (s) we can stay on the cache even when the cache is full -- Cache full count --
# that means Garbage Collector is never inactivating theses datas before this time is over
# >0 -> old data could stay in the cache while new data want's to come, if no data is deprecated
# 7200 -> entries older than 2 hours will be thrown to make some place
# 0 -> emptying full cache when full
apc.ttl =0
apc.user_ttl =0
# this one is the same but you should note this this prevent Garbage collecting
# after each source change.
apc.gc_ttl =0
# What to cache ? ----------------------------
# could be used to prevent some caching on specific files
# but it's better to cache often used files, isn't it? at least in production
#apc.filters ="-config.php-.ini"
# default to 1M, files bigger than that won't be cached
apc.max_file_size ="5M"
# various things -------------------------------
# only one process caching a same file (beter than apc.slam_defense)
php_fla apc.write_lock =1
# prevents caching half written files (by cp for example) by waiting x seconds
# for new files caching. set it to 0 if using only rsync or mv
apc.file_update_protection =2
# newest versions of APC only
# adding a lazy loading capabilities, so you can parse a lot of files
# and only used things are cached
#apc.lazy_functions =1
#apc.lazy_classes =1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
444 次 |
| 最近记录: |