使用新版本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 restartstopping httpd: [ ok ]starting httpd: [ ok ]
安装扩展
memcachesasl
[root@iz28vpjayxiz html]# yum install gcc+ gcc-c++loaded plugins: securitysetting up install processno package gcc+ available.package gcc-c++-4.4.7-11.el6.x86_64 already installed and latest versionnothing 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-develloaded plugins: securitysetting up install processpackage zlib-devel-1.2.3-29.el6.x86_64 already installed and latest versionnothing 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 yaryes#修改php.ini 增加 extension=yar.so#由于yar需要json支持,所以需要先加载json.so
以上就介绍了【php】阿里云升级php到5.5详解,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。