2011-02-13 28 views
25

我在嘗試使用apc_store()時收到此錯誤。我GOOGLE了它,看到這是APC定時炸彈的bug,並看到一些修正,建議在php.ini中添加apc.slam_defense = Off;PHP APC潛在緩存大滿貫迴避鍵

我需要知道這是否因爲編程錯誤而發生,如果是的話,如何解決它。

這是代碼段:

if ($data = apc_fetch("foo")) { 
    $an_array = $data; 
} else { 
    /* couple of lines */ 

    apc_store("circles", $an_array); // This is where I get the error 
} 

這個腳本會在我的部署系統頻繁調用。

我希望我提供足夠的信息提前

感謝

回答

28

設置apc.write_lock = 1apc.slam_defense = 0php.ini應該解決問題。

+0

固定的問題,我更新APC。 – 2012-12-19 17:35:17

2

這些說明將根據PHP的安裝方式而有所不同。

但是,在你的/etc/php5/cgi/conf.d/extensions.ini文件(或apc.ini,或php.ini)已添加後,您extension=apc.so可以禁用大滿貫防禦

例如,這是我的配置,我使用。

[apc] 
apc.enabled=1 
apc.shm_size=48M 
apc.num_files_hint=10000 
apc.user_entries_hint=10000 
apc.max_file_size=5M 
apc.stat=1 
apc.enable_cli=On 
apc.write_lock = 1 
apc.slam_defense = 0 # <----- This is the Important Setting 
5

最後APC的版本似乎解決問題,你可以用PECL

pecl upgrade apc