首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >APC & Wordpress:如果启用了APC,服务器将关闭

APC & Wordpress:如果启用了APC,服务器将关闭
EN

Stack Overflow用户
提问于 2013-05-31 18:42:44
回答 2查看 399关注 0票数 1

一些基本信息:

Linux: 2.6.32 (64位)

PHP: 5.4.15

Apache: 2.4.4

MySQL: 5.6.11

APC: 3.1.9

Wordpress: 3.5.1,带有Woocommerce(2.0.10)

问题是,当我启用APC时,出现了以下错误:

代码语言:javascript
复制
Warning: register_shutdown_function(): Invalid shutdown callback 'wpdb::__destruct' passed in /usr/local/httpd/htdocs/wp-includes/wp-db.php on line 537

Fatal error: Call to undefined method wpdb::init_charset() in /usr/local/httpd/htdocs/wp-includes/wp-db.php on line 542

下面是我在php.ini中的APC配置:

代码语言:javascript
复制
[APC]
; Reference: http://www.php.net/manual/en/apc.configuration.php
extension=apc.so

apc.enabled=1

apc.shm_segments=1

; 32MB per Wordpess install.  Ref: http://gregrickaby.com/the-perfect-apc-configuration/
apc.shm_size=320M

;Relative to the number of cached files (you may need to watch your stats for a day or two to find out a good number)
apc.num_files_hint=10000

;Relative to the size of WordPress
apc.user_entries_hint=10000

;The number of seconds a cache entry is allowed to idle in a slot before APC dumps the cache
apc.ttl=7200
apc.user_ttl=7200
apc.gc_ttl=3600

;Setting this to 0 will give you the best performance, as APC will
;not have to check the IO for changes. However, you must clear 
;the APC cache to recompile already cached files. If you are still
;developing, updating your site daily in WP-ADMIN, and running W3TC
;set this to 1
apc.stat=1

;This MUST be 0, WP can have errors otherwise!
apc.include_once_override=0

;Only set to 1 while debugging
apc.enable_cli=0

;Allow 2 seconds after a file is created before it is cached to prevent users from seeing half-written/weird pages
apc.file_update_protection=2

;Leave at 2M or lower. WordPress does't have any file sizes close to 2M
apc.max_file_size=2M

;Ignore files
apc.filters = "/usr/local/httpd/htdocs/apc.php,/usr/local/httpd/htdocs/phpinfo.php,wp-cache-config"

apc.cache_by_default=1
apc.use_request_time=1
apc.slam_defense=0
;apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.stat_ctime=1
apc.canonicalize=1
apc.write_lock=1
apc.report_autofilter=0
apc.rfc1867=0
apc.rfc1867_prefix =upload_
apc.rfc1867_name=APC_UPLOAD_PROGRESS
apc.rfc1867_freq=0
apc.rfc1867_ttl=3600
apc.lazy_classes=0
apc.lazy_functions=0
apc.file_md5=0

以下是我尝试的一些组合:

代码语言:javascript
复制
apc.stat = 0, apc.stat_ctime=0

apc.stat = 1, apc.stat_ctime=1

apc.stat = 0, apc.stat_ctime=1

apc.stat = 0, apc.stat_ctime=0

但是,APC仍然不能使用。只有当我禁用APC时,站点才能正常工作。

有人能告诉我问题出在哪里吗?

提前谢谢你。

APC config in image

EN

回答 2

Stack Overflow用户

发布于 2013-05-31 18:55:01

可能APC没有正确解释register_shutdown_function的语法。使用此函数定义静态方法回调有两种方式:

  1. register_shutdown_function('someClass::someMethod');
  2. register_shutdown_function(array('someClass', 'someMethod'));

你可以参考文档和评论来获得更多信息:http://php.net/manual/en/function.register-shutdown-function.php

票数 1
EN

Stack Overflow用户

发布于 2013-12-13 22:21:53

当我在php.ini中禁用了apc时,Wordpress也适用于我。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16855431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档