• CentOS-6.4 安装 PHP Memcached 扩展


    1、获取安装文件包

    [root@phpdragon home]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
    [root@phpdragon home]# wget https://pecl.php.net/get/memcached-2.2.0.tgz

    2、安装前编译环境的准备

    [root@phpdragon home]# yum install gcc
    [root@phpdragon home]# yum install gcc-c++ 
    [root@phpdragon home]# yum install zlib
    [root@phpdragon home]# yum install zlib-devel

    3、安装libmemcached 

    [root@phpdragon home]# tar -zxvf libmemcached-1.0.18.tar.gz
    [root@phpdragon home]# cd libmemcached-1.0.18
    [root@phpdragon libmemcached-1.0.18]# whereis memcached //获取memcached的安装目录
    memcached: /usr/local/bin/memcached
    
    [root@phpdragon home]# ./configure -prefix=/usr/local/libmemcached -with-memcached=/usr/local/bin/memcached
    [root@phpdragon libmemcached-1.0.18]# make && make install
    
    [root@phpdragon libmemcached-1.0.18]# whereis libmemcached  //获取libmemcached的安装目录
    libmemcached: /usr/local/libmemcached

    4、安装php-memcached 

    [root@phpdragon home]# tar -zxvf php_memcached-2.2.0.tgz
    [root@phpdragon home]# cd memcached-2.2.0/
    [root@phpdragon memcached-2.2.0]# phpize  //显示没有安装phpize
    -bash: phpize: command not found
    [root@phpdragon memcached-2.2.0]# yum install php-devel  //安装phpize
    [root@phpdragon memcached-2.2.0]# phpize
    [root@phpdragon memcached-2.2.0]# ./configure --with-php-config=/usr/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
    Installing shared extensions:     /usr/lib64/php/modules/

    vi /etc/php.d/memcached.ini  保存退出

    ; ----- Enable memcache extension module
    extension=memcached.so
    
    ; ----- Options for the memcache module
    
    ;  Whether to transparently failover to other servers on errors
    ;memcache.allow_failover=1
    ;  Data will be transferred in chunks of this size
    ;memcache.chunk_size=32768
    ;  Autocompress large data
    ;memcache.compress_threshold=20000
    ;  The default TCP port number to use when connecting to the memcached server 
    ;memcache.default_port=11211
    ;  Hash function {crc32, fnv}
    ;memcache.hash_function=crc32
    ;  Hash strategy {standard, consistent}
    ;memcache.hash_strategy=consistent
    ;  Defines how many servers to try when setting and getting data.
    ;memcache.max_failover_attempts=20
    ;  The protocol {ascii, binary} : You need a memcached >= 1.3.0 to use the binary protocol
    ;  The binary protocol results in less traffic and is more efficient
    ;memcache.protocol=ascii
    ;  Redundancy : When enabled the client sends requests to N servers in parallel
    ;memcache.redundancy=1
    ;memcache.session_redundancy=2
    ;  Lock Timeout
    ;memcache.lock_timeout = 15
    
    ; ----- Options to use the memcache session handler
    
    ;  Use memcache as a session handler
    ;session.save_handler=memcache
    ;  Defines a comma separated of server urls to use for session storage
    ;session.save_path="tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"

     重启PHP-fpm

    [root@phpdragon home]# service php-fpm start
  • 相关阅读:
    吴恩达机器学习课程笔记章节二单变量线性回归
    cs224n第六讲依存分析
    吴恩达机器学习课程笔记章节一绪论
    cs224n第二讲词向量表示:word2vec
    cs224n第一讲深度自然语言处理
    DIY的.net正则表达式工具
    不写一行代码,利用常用工具和软件批量下载URL资源
    WEB页面采集器编写经验之一:静态页面采集器
    大规模IP地址黑名单高性能查询实现
    安卓开发入门与面试题01(潭州安卓开发入门教程)
  • 原文地址:https://www.cnblogs.com/phpdragon/p/4507833.html
Copyright © 2020-2023  润新知