[英]php memcached error
每次我嘗試使用memcached的add()函數時,我都會收到以下錯誤:
A PHP Error was encountered
Severity: Warning
Message: MemcachePool::add(): The lowest two bytes of the flags array is reserved for pecl/memcache internal use
Filename: libraries/memcached_library.php
Line Number: 92
可能有什么不對? 我正在使用這個庫進行codeigniter: http : //github.com/trs21219/memcached-library
你是64位嗎? 它看起來像是pecl / memcache最近發現的錯誤: http ://pecl.php.net/bugs/bug.php?id = 18567
它似乎與壓縮標志有關。 它不能再是布爾值,根據此源代碼需要是一個整數
/**
* The compressed argument on Memcache::add, Memcache::set and Memcache::replace takes
* an integer not a boolean. Since pecl/memcache 3.0.3 booleans now leads to warnings like
* The lowest two bytes of the flags array is reserved for pecl/memcache internal use
*/
可能是你的情況:使用memcache的一些手冊,比如http://www.codeforest.net/how-to-install-memcached-on-windows-machine ,有一個錯誤 :
$memcache->add("key", $tmp, 30);
但正確使用expiration seconds參數(這里30秒)是:
$memcache->add("key", $tmp, MEMCACHE_COMPRESSED, 30);
或者喜歡
$memcache->add("key", $tmp, false, 30);
正確示例的手冊示例:http: //zurmo.org/wiki/installing-memcache-on-windows
另見文檔http://php.net/manual/ru/memcache.add.php
對我來說這是關鍵。
您可以添加'false'作為第三個參數,它對我有用。
Warning (2): MemcachePool::add() [memcachepool.add]: The lowest two bytes of the flags array is reserved for pecl/memcache internal use
From:
return $this->memcache->add($name, $value, $expiry);
To:
return $this->memcache->add($name, $value, false, $expiry);
這可能對某些人有幫助,我已經下載了一個codeigniter庫,它使用memcache而不是memcached用於會話。 它可以在這里找到: https : //github.com/pierskarsenbarg/codeigniter-session-memcached
對我來說問題是當lib使用時
memcache->set()
和/或
memcache->replace()
第三個參數是過期時間而不是有效的標志類型。
即MEMCACHE_COMPRESSED
例
原始代碼:
$this->memcache->set('user_session_data' . $this->userdata['session_id'], $this->userdata, $this->sess_expiration);
改變代碼:
$this->memcache->set('user_session_data' . $this->userdata['session_id'], $this->userdata, MEMCACHE_COMPRESSED, $this->sess_expiration);
將第三個參數更改為正確的標志類型后,錯誤就消失了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.