安装php7的memcached扩展
.编译安装libmemcached-1.0.
wget https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz tar -zxvf libmemcached-1.0..tar.gz
cd libmemcached-1.0.
./configure --prefix=/usr/local/libmemcached --with-memcached
make && make install . 安装php-memcached扩展
php使用memcache的扩展有两个,一个memcache,一个memcached,前者比较老,推荐使用第二个,我们这里以第二个为例: 在github上找到适用于php7的分支(https://github.com/php-memcached-dev/php-memcached/tree/php7),同样使用wget下载zip压缩包,解压缩,进入目录,依次执行下列命令(其中php-config和libmemcached目录根据具体情况设定,可以使用whereis或者find来查找 # 解压
cd php-memcached-php7 # 执行phpize会生成configure文件
/usr/local/php/bin/phpize
# 执行预编译
./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make
make install [root@szxxlfhtest02t:/usr/local/src/php-memcached-php7]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No: [root@szxxlfhtest02t:/usr/local/src/php-memcached-php7]# make install
Libraries have been installed in:
/usr/local/src/php-memcached-php7/modules If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for
more information, such as the ld() and ld.so() manual pages.
---------------------------------------------------------------------- Build complete.
Don't forget to run 'make test'. Installing shared extensions: /usr/local/php-7.0.12_fpm/lib/php/extensions/no-debug-non-zts-/ 修改php.ini的配置
加上:extension_dir="/usr/local/php7.1/lib/php/extensions/no-debug-non-zts-20160303/"(每个人的路径可能不一样)
extension = "memcached.so
重启php-fpm . 修改php.ini文件
(php.ini文件具体位置可以通过phpinfo()函数来查看到),在php.ini文件之中加入下面这句: # vim /usr/local/php-7.0.12_fpm/lib/php.ini
extension_dir="/usr/local/php-7.0.12_fpm/lib/php/extensions/no-debug-non-zts-20151012/"
extension=memcached.so [root@szxxlfhtest02t:~]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mcrypt
memcache
memcached .测试是否安装成功 [root@szxxlfhtest02t:/data/www/vhosts/cmstest.chinasoft.com/httpdocs]# cat mem.php
<?php $mem = new Memcached(); //创建一个memcached对象
$mem->addServer('127.0.0.1',); //连接memcached
$mem->set("key","test");//设置一个变量到内存中,名称是key 值是test
$get_value = $mem->get('key'); //从内存中取出key的值
if($mem->getResultCode() == Memcached::RES_NOTFOUND) //如果该名称的变量没有设置
{
echo 'not set!';
}
else
{
echo $get_value;
} *************************** [root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# cat /usr/local/nginx/conf/cms.d/cmsx.chinasoft.com.wx.conf
server {
listen ;
server_name cmsx.chinasoft.com.wx cmsx.chinasoft.com.wx.wx;
access_log /data/www/logs/nginx_log/access/cmsx.chinasoft.com.wx_access.log main ;
access_log on;
error_log /data/www/logs/nginx_log/error/cmsx.chinasoft.com.wx_error.log ;
root /data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public/;
index index.html index.shtml index.php ;
include rewrite.d/cmsx.chinasoft.com.wx.conf ;
error_page /.html;
access_log on; #location / {
# expires -;
# proxy_pass http://php_pool;
# include proxy_params;
#} #location / {
# index index.php index.html index.htm;
# try_files $uri $uri/ /index.php?$query_string;
#} #location ~ \.php$ {
# fastcgi_pass unix:/tmp/php-cgi.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
#}
location / {
index index.php index.html index.htm; if (!-e $request_filename) {
rewrite . /index.php last;
}
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} }

centos6下安装php7的memcached扩展的更多相关文章

  1. window下安装php7的memcache扩展

    安装memcache:http://www.runoob.com/memcached/memcached-connection.html1.4.4 c:\memcached\memcached.exe ...

  2. PHP7 下安装 memcache 和 memcached 扩展

    转载自:https://www.jianshu.com/p/c06051207f6e Memcached 是高性能的分布式内存缓存服务器,而PHP memcache 和 memcached 都是 Me ...

  3. Linux下安装php的memcached扩展(memcache的客户端)

    php的扩展memcache,不支持cas,所以我们要装memcached扩展,memcached扩展是基于libmemcached,所以要先安装libmemcached 一.下载软件 1.libme ...

  4. CentOS6下安装PHP7

    更新软件源[1] wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpm ...

  5. mac 下安装php7.1 memcache扩展

    1.下载memcache源代码文件 https://github.com/websupport-sk/pecl-memcache/archive/php7.zip 文件夹名为:pecl-memcach ...

  6. php7安装memcache 和 memcached 扩展

    php7安装memcache 和 memcached 扩展 标签(空格分隔): php memcache和memcached区别 memcache:http://pecl.php.net/packag ...

  7. centos6下安装dedecms

    几经波折,终于安装成功!!! 一.centos6下安装WDCP 1.连接linux 在百度直接搜索下载xshell,通过ssh连接 2.安装wdcp 下载安装wget http://dl.wdlinu ...

  8. CentOS7下安装Mysql和Memcached 以及 使用C#操作Mysql和Memcached

    我本身是学.net的,但是现在很多主流SQL和NOSQL都是部置在linux下,本着好学的精神,前段时间装了个虚拟机,在其装上CentOS64位的服务器系统,对于英文0基础,linux0基础的我来说, ...

  9. Mysql系列三:Centos6下安装Mysql和Mysql主从复制的搭建

    一.Centos6下安装Mysql 检测下系统有没有自带的mysql:yum list installed | grep mysql, 如果已经有的话执行命令yum -y remove mysql-l ...

随机推荐

  1. log4j日志文件名与行号显示乱码? 问号? 参数问号? 日志问号?【转】【补】

    log4j本来设置了要打印行号与文件名的,结果有的能打印出来,有的却是乱码,查了些文档之后才发现,原来打印问题是因为编绎时没有编绎进去调试信息,所以没办法打印,好像有的系统又会显示(Unknown S ...

  2. Linux 下装逼技巧

    ``` 1.下载cmatrix-1.2a.tar.gz文件 [root@localhost ~]# wget https://jaist.dl.sourceforge.net/project/cmat ...

  3. python --端点调试

    python端点调试 左边三角:快速跳到下一个端点 下箭头:单不调试 斜向下箭头:跳到函数内部执行代码

  4. 使用js修改url地址参数

    该方法可以修改url的参数. 例如将 www.baidu.com 修改为 www.baidu.com?name=123 操作为: window.location.href = changeURLArg ...

  5. C++解决case中不能定义局部变量问题

    case Operation::DeviceAuthen: { std::string token = root["body"]["token"].asStri ...

  6. 解决XP系统桌面图标蓝底

    方法1:在桌面上点击右键,在"排列图标"里去掉"锁定桌面的web项目"的勾. 方法2:右键点击 的电脑 -- 属性 -- 高级 -- 点击"性能&qu ...

  7. sqlserver导入execl

    一.找到导入导出的工具 找到安装目录 C:\Program Files\Microsoft SQL Server\100\DTS\Binn 里面的DTSWizard.exe 二.打开exe 然后下一步 ...

  8. Kali Linux之使用SET快捷生成钓鱼网站方法

    SET (Social Engineering Tools) 1.使用命令:setoolkit 会显示工具菜单 2.输入1 ,选择菜单中的Social-Engineering Attacks (社会工 ...

  9. java设计模式之单例模式以及实现的几种方法

    java设计模式以及实现的几种方法,看到比较好的博客文章,收藏起来供以后再次阅读.. 参见:http://www.cnblogs.com/garryfu/p/7976546.html

  10. Django之CRM项目Day5-跳转页面 跟进记录 报名记录

    1 编辑和添加后跳转页面: 思路:写一个参数将路径的条件带上 注意:捋流程的时候从urls里开始 1.在crm文件夹下新建python包:templatetags,在包里新建url.py: from ...