目的
使用新版本PHP,提高代码执行效率
和线下环境的不同
数据库采用RDS服务,本地不需要安装MYSQL
使用缓存服务,需要安装官方的memcached扩展
需要安装的扩展
memcached,yar,memcached,apc,mycrypt
安装
升级php
[root@iZ28vpjayxiZ ~]# yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
[root@iZ28vpjayxiZ ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
[root@iZ28vpjayxiZ ~]# yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache
[root@iZ28vpjayxiZ ~]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
安装扩展
MemcacheSASL
[root@iZ28vpjayxiZ html]# yum install gcc+ gcc-c++ Loaded plugins: security Setting up Install Process No package gcc+ available. Package gcc-c++-4.4.7-11.el6.x86_64 already installed and latest version Nothing to do [root@iZ28vpjayxiZ html]# yum install cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib [root@iZ28vpjayxiZ ~]# wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz [root@iZ28vpjayxiZ ~]# tar zxvf libmemcached-1.0.16.tar.gz [root@iZ28vpjayxiZ ~]# cd libmemcached-1.0.16 [root@iZ28vpjayxiZ libmemcached-1.0.16]# ./configure --prefix=/usr/local/libmemcached --enable-sasl * CPP Flags: -fvisibility=hidden * LIB Flags: * Assertions enabled: no * Debug enabled: no * Shared: yes * Warnings as failure: no * SASL support: yes * make -j: 2 * VCS checkout: no [root@iZ28vpjayxiZ libmemcached-1.0.16]# make && make install [root@iZ28vpjayxiZ libmemcached-1.0.16]# cd ../ [root@iZ28vpjayxiZ ~]# yum install zlib-devel Loaded plugins: security Setting up Install Process Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version Nothing to do [root@iZ28vpjayxiZ ~]# wget http://pecl.php.net/get/memcached-2.1.0.tgz [root@iZ28vpjayxiZ ~]# tar zxvf memcached-2.1.0.tgz [root@iZ28vpjayxiZ ~]# cd memcached-2.1.0 [root@iZ28vpjayxiZ memcached-2.1.0]# phpize [root@iZ28vpjayxiZ memcached-2.1.0]# ./configure --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-sasl [root@iZ28vpjayxiZ memcached-2.1.0]# make && make install 最后修改php.ini文件(locate找该文件,yum安装的一般在/etc/php.ini 如果系统中有两套PHP环境,需找到使用OCS的PHP环境路径,对应修改之),增加extension=memcached.so memcached.use_sasl = 1 执行php –m |grep memcached 如显结果有 memcache 表示环境已支持memcache
yar
[root@iZ28vpjayxiZ ~]# pecl install channel://pecl.php.net/msgpack-0.5.5 #修改php.ini 增加 extension=msgpack.so [root@iZ28vpjayxiZ ~]# pecl install yar yes #修改php.ini 增加 extension=yar.so #由于yar需要json支持,所以需要先加载json.so
时间: 2024-11-10 01:22:57