7

在我的新 Xubuntubox 上,我安装了lamp-server工具 , phpphp-apc将该extension=apc.so行添加到 php.ini 并重新启动系统。Apache 和 PHP 似乎运行良好,但 APC 却不行。

所以我检查了 apc.php 文件的内容:

No cache info available. APC does not appear to be running.

但在 php 信息中,它似乎已启用。看看怎么php -i | grep 'apc'说:

Additional .ini files parsed => /etc/php5/cli/conf.d/apc.ini,
apc
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On             <- it is enabled
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On

果然php -m | grep 'apc'也发现了apc

您知道缺少什么,我无法正确使用它吗?

4

1 回答 1

9

两种方法可以运行 PHP。

您正在显示 PHP 的 CLI 配置,而 apc.php 没有使用它。

事实上,如果您phpinfo()通过浏览器检查,您可以看到没有加载任何 APC 扩展。

解决方案:/etc/php5/cgi/conf.d/apc.ini在(cgi不是)打开cli并再次将您的配置粘贴到那里。重新启动 Web 服务器 ( sudo service httpd restart),瞧!

希望这可以帮助 !

于 2012-05-23T08:50:29.223 回答