Purpose
Use the new version of PHP to improve code execution efficiency
Difference from the offline environment
The database uses RDS service, there is no need to install MYSQL locally
To use the cache service, you need to install the official memcached extension
Required to install Extensions
memcached,yar,memcached,apc,mycrypt
Install
Upgrade 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 ]
Install extensions
[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
[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
The above introduces [PHP] Alibaba Cloud’s detailed explanation of upgrading PHP to 5.5, including all aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Zend Studio 13.0.1
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
