PHP:APC 已启用,但仍然不起作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10716216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP: APC enabled, but still doesn't work?
提问by erikbwork
On my new Xubuntubox I installed the lamp-servertools, php, php-apc, added the extension=apc.soline to the php.ini and rebootet the system. Apache and PHP seem to work well, but APC doesn't.
在我的新 Xubuntubox 上,我安装了lamp-server工具 , php,php-apc将该extension=apc.so行添加到 php.ini 并重新启动系统。Apache 和 PHP 似乎运行良好,但 APC 不行。
So I checked what the apc.php file would say:
所以我检查了 apc.php 文件会说什么:
No cache info available. APC does not appear to be running.
But in the php info it seems to be enabled. Have a look what php -i | grep 'apc'says:
但在 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
As expected php -m | grep 'apc'also finds apc.
果然php -m | grep 'apc'也发现了apc。
Do you know what is missing, that I can't use it correctly?
你知道我不能正确使用它吗?
回答by Justin T.
There are twoways to run PHP.
有两种方法可以运行 PHP。
You are showing the CLI configuration for PHP, and apc.php is not using it.
您正在显示 PHP 的 CLI 配置,而 apc.php 没有使用它。
Indeed, if you check phpinfo()through your browser, you can see that no APC extension is loaded.
事实上,如果您检查phpinfo()浏览器,您会看到没有加载 APC 扩展。
The solution :Open at /etc/php5/cgi/conf.d/apc.ini(cginot cli) and paste your configuration there, again. Restart the web server (sudo service httpd restart) and voilà !
解决方案:在/etc/php5/cgi/conf.d/apc.ini(cgi不是cli)打开并再次粘贴您的配置。重新启动 Web 服务器 ( sudo service httpd restart) 并瞧!
Hope this helps !
希望这可以帮助 !

