Hi again,
I misconfigured first, but then I found solutions for my problems via mixing method.
I followed these steps:
1. Install Webtatic repo and libmemcached:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install libmemcached10-devel
2. Install memcached libevent and compile it
yum install memcached libevent libevent-devel nc -y
cd /usr/src/
wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar -zxvf memcached-2.2.0.tgz
cd memcached-2.2.0/
phpize
./configure
(if command does not work, try with this: "./configure --with-libmemcached-dir")
make && make install
3. open /usr/local/php/php.ini and add to the bottom: "extension=/usr/src/memcached-2.2.0/modules/memcached.so" without quotation marks
service httpd reload
4. Configure memcached
vi /etc/sysconfig/memcached
5. Restart memcached
/etc/init.d/memcached restart
We can configure memcached settings as:
vi /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
# max connection 1024
MAXCONN="1024"
# set ram size to 512 MB
CACHESIZE="512"
# listen to loopback ip 127.0.0.1, for network connection use real ip e.g., 10.0.0.4
OPTIONS="-l 127.0.0.1"
Moreover, If we need to increase timeout from 65535 seconds to almost 1 year (because, we can get this error while writing: "udf_flags will be limited to 65535") to store data in memcached, I edited and recomplied c code like this:
vi /usr/src/memcached-2.2.0/php_memcached.c
change this line (16 means 2^16 seconds):
"#define MEMC_VAL_USER_FLAGS_MAX ((1 << 16) - 1)"
with this line (25 means 2^25 seconds):
"#define MEMC_VAL_USER_FLAGS_MAX ((1 << 25) - 1)"
and turn phpize step and continue again.
Hope to help someone.