切换到 PHP 7 之后,网站的速度大幅提升,不过通常的扩展可能某一个就还没有支持 PHP7

Memcached

比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 memcached 就还没有,不过好在,它已经支持了 PHP 7 ,只是没有源而已,我们手动编译它。

要安装 memcached,需要先安装依赖库 libmemcached

从这里找到最新的 libmemcached 源码包,然后下载

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18/
./configure
make
make install

安装好依赖库之后,我们来安装 memcached :

从 github 克隆 memcached 后,需要手动切换到 php7 分支,不然会提示
fatal error: ext/standard/php_smart_str.h: No such file or directory错误.

git clone https://github.com/php-memcached-dev/php-memcached.git
cd php-memcached/
git checkout php7
phpize
./configure --disable-memcached-sasl
make
make install

Redis

同样的,Redis其实也已经有了 PHP 7 版本,我们从 github 上获取项目克隆,然后手动切换到 php7 分支即可:

git clone https://github.com/phpredis/phpredis.git
cd phpredis/
git checkout php7
phpize
./configure
make
make install

启动扩展

光安装了还不够,我们还需要编辑PHP的配置文件来使扩展被加载才行,
vi /etc/php/7.0/fpm/php.ini ,在配置文件中添加如下语句:

extension=memcached.so
extension=redis.so

最后使用命令来重启 PHP 服务: service php7.0-fpm restart

Ubuntu 16.04 为 PHP7 添加 memcached 以及 redis 扩展的更多相关文章

  1. linux下php7安装memcached、redis扩展

    linux下php7安装memcached.redis扩展 1.php7安装Memcached扩展 比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 memcache ...

  2. Ubuntu 16.04通过Magent搭建Memcached集群(转)

    一.下载Magent 官网:https://code.google.com/archive/p/memagent/downloads 离线版本:(链接: https://pan.baidu.com/s ...

  3. Ubuntu 16.04 LTS安装 TeamViewer

    Ubuntu 16.04 LTS安装 TeamViewer     64位Ubuntu 16.04系统需要添加32位架构支持,命令如下. sudo dpkg --add-architecture i3 ...

  4. 如何在Ubuntu 16.04上安装配置Redis

    如何在Ubuntu 16.04上安装配置Redis Redis是一个内存中的键值存储,以其灵活性,性能和广泛的语言支持而闻名.在本指南中,我们将演示如何在Ubuntu 16.04服务器上安装和配置Re ...

  5. Ubuntu 16.04 安装 Wireshark分析tcpdump的pcap包——sudo apt install wireshark-qt

    tcpdump 的抓包保存到文件的命令参数是-w xxx.cap   抓eth1的包  tcpdump -i eth1 -w /tmp/xxx.cap    抓 192.168.1.123的包  tc ...

  6. Ubuntu 16.04 LAMP server 指南 - 配置 Apache2.4,PHP7,和MariaDB(而不是MySQL)

    翻译自:https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/ 昨天在虚 ...

  7. PHP7 学习笔记(一)Ubuntu 16.04 编译安装Nginx-1.10.3、 PHP7.0.9、Redis3.0 扩展、Phalcon3.1 扩展、Swoole1.9.8 扩展、ssh2扩展(全程编译安装)

    ==================== PHP 7.0 编译安装================== wget http://cn2.php.net/get/php-7.0.9.tar.bz2/fr ...

  8. Ubuntu 16.04 源码编译安装PHP7+swoole

    备注: Ubuntu 16.04 Server 版安装过程图文详解 Ubuntu16镜像地址: 链接:https://pan.baidu.com/s/1XTVS6BdwPPmSsF-cYF6B7Q 密 ...

  9. Ubuntu 16.04安装Memcached(单机)

    Ubuntu 16.04安装Memcached,不过不仅限与Ubuntu,可以用CentOS等去安装,只不过测试时使用的是Ubuntu机器.Windows下不建议使用,本机调试可以使用,线上环境除了W ...

随机推荐

  1. smarty基础原理

    smarty基础原理 一.html模板页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &q ...

  2. 450. Delete Node in a BST

    Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...

  3. python 课堂笔记-购物车

    # Author:leon production_list = [ ('iphone',5800), ('mac pro', 9800), ('bike', 800), ('watch', 10600 ...

  4. React setState更新数组中的某个元素Element item

    var items = this.state.items; items[i].status = 'doing'; this.setState({ items: items }); //this.sta ...

  5. ORM实例介绍

    http://blog.csdn.net/RonoTian/article/details/2900714

  6. SQL生成一串随机数

    SELECT RIGHT (CONVERT(VARCHAR(20),CONVERT(DECIMAL(20,15),rand())),15) AS c_random_number

  7. SQL SERVER 索引中聚集索引分析和Transact-SQL语句优化

    一. 聚集索引B树分析1.聚集索引按B树结构进行组织的,索引B树种的每一页称为一个索引节点.B树的顶端节点称为根节点.  索引中的低层节点称为叶节点.根节点与叶节点之间的任何索引级别统称为中间级.在聚 ...

  8. 数字图像处理,图像锐化算法的C++实现

    http://blog.csdn.net/ebowtang/article/details/38961399 之前一段我们提到的算法都是和平滑有关, 经过平滑算法之后, 图像锐度降低, 降低到一定程度 ...

  9. Sybase:SAP IQ学习笔记

    Sybase:SAP IQ学习笔记 -- 启动IQ管理 >> start_iq -n utility_db -n utility_db >> dbisql -c "u ...

  10. 什么时候需要用super

    1.子类构造函数调用父类构造函数用super 2.子类重写(覆盖)父类方法后,若想调用父类中被重写的方法,用super 3.未被重写的方法可以直接调用.