在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0
编译自:http://linoxide.com/linux-how-to/install-php-7-centos-7-fedora-21/作者: Aun Raza
原创:LCTT https://linux.cn/article-5501-1.html译者: wi-cuckoo
转载地址:https://linux.cn/article-5501-1.html
PHP7
- 为了改善执行效率与内存占用,新的版本添加了PHPNG功能。
- 引入了JIT引擎来动态编译Zend操作码为自然机器码,以此来达到更快的处理性能。这项功能允许随后的程序调用同一份代码,这样会运行快很多。
- AST(抽象语法树)是最新添加的功能,它可以增强支持PHP的扩展性和用户应用。
- 添加异步编程功能以支持同一个请求中的并行任务。
- 新的版本会支持独立的多线程网页服务器,这样可以使用一个单独的存储池处理很多并发的请求。

在CentOS/Fedora上安装PHP 7
让我们来看看怎样在CentOS 7和Fedora 21安装PHP7。为了安装PHP7,我们首先需要克隆php-src 仓库。当克隆工作完成,我们再配置和编译它。进行下一步之前,我们要确保已经在LInux系统下安装了如下的组件,否则PHP编译会返回错误中止。
- Git
- autoconf
- gcc
- bison
所有上面提到的要求可以使用Yum软件包管理器安装。以下一条命令即可完成:
yum install git autoconf gcc bison
准备好开始安装PHP7了吗?让我们先创建一个PHP7目录,作为你的当前工作目录。
mkdir php7cd php7
现在克隆php-src仓库,在终端里运行下面的命令。
git clone https://git.php.net/repository/php-src.git
/*我这里网特别慢,我看了个电影看了顿饭又睡了一觉才好*/
这里是一个样例输出,你应该会在任务完成时看见。
[root@localhost php7]# git clone https://git.php.net/repository/php-src.gitCloning into 'php-src'...remote: Counting objects: 615064, done.remote: Compressing objects: 100% (127800/127800), done.remote: Total 615064 (delta 492063), reused 608718 (delta 485944)Receiving objects: 100% (615064/615064), 152.32 MiB | 16.97 MiB/s, done.Resolving deltas: 100% (492063/492063), done.
让我们来配置,编译PHP7,在终端运行下面的命令,开始配置工作:
cd php-src./buildconf
下面是./buildconf命令的样例输出。
[root@localhost php-src]# ./buildconfbuildconf: checking installation...buildconf: autoconf version 2.69 (ok)rebuilding aclocal.m4rebuilding configurerebuilding main/php_config.h.in
使用下面的命令,继续配置进程:
./configure \--prefix=$HOME/php7/usr \--with-config-file-path=$HOME/php7/usr/etc \--enable-mbstring \--enable-zip \--enable-bcmath \--enable-pcntl \--enable-ftp \--enable-exif \--enable-calendar \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-wddx \--with-curl \--with-mcrypt \--with-iconv \--with-gmp \--with-pspell \--with-gd \--with-jpeg-dir=/usr \--with-png-dir=/usr \--with-zlib-dir=/usr \--with-xpm-dir=/usr \--with-freetype-dir=/usr \--with-t1lib=/usr \--enable-gd-native-ttf \--enable-gd-jis-conv \--with-openssl \--with-mysql=/usr \--with-pdo-mysql=/usr \--with-gettext=/usr \--with-zlib=/usr \--with-bz2=/usr \--with-recode=/usr \--with-mysqli=/usr/bin/mysql_config
这会花去不少的时间,当完成后你应该会看到如下面的输出:
creating libtoolappending configuration tag "CXX" to libtoolGenerating filesconfigure: creating ./config.statuscreating main/internal_functions.ccreating main/internal_functions_cli.c+--------------------------------------------------------------------+| License: || This software is subject to the PHP License, available in this || distribution in the file LICENSE. By continuing this installation || process, you are bound by the terms of this license agreement. || If you do not agree with the terms of this license, you must abort || the installation process at this point. |+--------------------------------------------------------------------+Thank you for using PHP.config.status: creating php7.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/phpizeconfig.status: creating scripts/man1/phpize.1config.status: creating scripts/php-configconfig.status: creating scripts/man1/php-config.1config.status: creating sapi/cli/php.1config.status: creating sapi/cgi/php-cgi.1config.status: creating ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: creating main/php_config.hconfig.status: executing default commands
运行下面的命令,完成编译过程。
make
“make”命令的样例输出如下所示:
Generating phar.phpGenerating phar.pharPEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.clicommand.incdirectorytreeiterator.incdirectorygraphiterator.incpharcommand.incinvertedregexiterator.incphar.incBuild complete.Don't forget to run 'make test'.
安装PHP7,运行下面的命令安装它。
make install
成功安装的进程的样例输出应该像这样:
[root@localhost php-src]# make installInstalling shared extensions: /root/php7/usr/lib/php/extensions/no-debug-non-zts-20141001/Installing PHP CLI binary: /root/php7/usr/bin/Installing PHP CLI man page: /root/php7/usr/php/man/man1/Installing PHP CGI binary: /root/php7/usr/bin/Installing PHP CGI man page: /root/php7/usr/php/man/man1/Installing build environment: /root/php7/usr/lib/php/build/Installing header files: /root/php7/usr/include/php/Installing helper programs: /root/php7/usr/bin/program: phpizeprogram: php-configInstalling man pages: /root/php7/usr/php/man/man1/page: phpize.1page: php-config.1Installing PEAR environment: /root/php7/usr/lib/php/[PEAR] Archive_Tar - installed: 1.3.13[PEAR] Console_Getopt - installed: 1.3.1[PEAR] Structures_Graph- installed: 1.0.4[PEAR] XML_Util - installed: 1.2.3[PEAR] PEAR - installed: 1.9.5Wrote PEAR system config file at: /root/php7/usr/etc/pear.confYou may want to add: /root/php7/usr/lib/php to your php.ini include_path/root/php7/php-src/build/shtool install -c ext/phar/phar.phar /root/php7/usr/binln -s -f /root/php7/usr/bin/phar.phar /root/php7/usr/bin/pharInstalling PDO headers: /root/php7/usr/include/php/ext/pdo/
恭喜你,PHP7已经安装在你的Linux系统上了。安装完后,进入PHP7安装文件里的sapi/cli里面。
cd sapi/cli
验证一下PHP的版本。
[root@localhost cli]# ./php -vPHP 7.0.0-dev (cli) (built: Mar 28 2015 00:54:11)Copyright (c) 1997-2015 The PHP GroupZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
总结
PHP 7也添加到了remi仓库,这个即将到来的版本主要关注执行效率的提升,它的新特性致力于使PHP较好满足现代编程的需求和趋势。PHP 7.0将会有许多新的特性、丢弃一些老版本的东西。在接下来的日子里,我们希望看到新特性和弃用功能的具体情况。希望你喜欢!
在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0的更多相关文章
- 在同一个硬盘上安装多个 Linux 发行版及 Fedora 21 、Fedora 22 初体验
在同一个硬盘上安装多个 Linux 发行版 以前对多个 Linux 发行版的折腾主要是在虚拟机上完成.我的桌面电脑性能比较强大,玩玩虚拟机没啥问题,但是笔记本电脑就不行了.要在我的笔记本电脑上折腾多个 ...
- Fedora 21 安装 Nvidia 驱动以及失败后的补救方法
在 Linux 桌面系统下玩了这么久,大部分时间都是使用 Ubuntu,偶尔使用一下 Fedora.我的电脑中安装有多个 Linux 发行版,见这里<在同一个硬盘上安装多个Linux发行版及Fe ...
- Fedora 21 64位系统安装WPS教程
WPS的Linux版本的出现简直是Linux党的福音,Ubuntu上的WPS安装非常简单,但是在Fedora上却有点小麻烦.主要是库的依赖问题.下面记录一下Fedora 21的64位版安装WPS的完整 ...
- Fedora 21 install chrome
Steps to install Google Chrome on Fedora 21 A. Create google-chrome.repo file Use this command to cr ...
- Fedora 21 中添加及更新源的命令
原文: Fedora 21 中添加及更新源的命令 fedora的软件源信息文件(*.repo)都是放在 /etc/yum.repos.d 目录下的.可以通过# ls -l /etc/yum.repos ...
- Fedora 21 安装Infinality
原文地址: Fedora 21 用infinality美化你的字体 http://blog.csdn.net/element207/article/details/41746683 安装infinal ...
- Fedora 21 安装 Budgie Desktop
最新文章:Virson's Blog Budgie Desktop 是一款自由开源桌面,是 Evolve OS 的默认桌面,Evolve OS 是一款 OpenSUSE 的衍生系统.Budgie De ...
- 安装Fedora 21工作站后要做的10件事情
教程]安装Fedora 21工作站后要做的10件事情 2015-01-07 13:32 CSDN CODE 作者CSDN CODE 1 755 FedoraGNOMELinux Fedora 21已经 ...
- [转载]Install Opera 12.16 Web Browser in CentOS/RHEL and Fedora
FROM: http://tecadmin.net/install-opera-web-browser-in-centos-rhel-fedora/ Opera is an modern web br ...
随机推荐
- C# 中 多线程同步退出方案 CancellationTokenSource
C# 中提供多线程同步退出机制,详参对象: CancellationTokenSource CancellationTokenSource 中暂未提供复位操作,因此当调用Cancle 之后,若再次调用 ...
- struts入门实例
入门实例 1 .下载struts-2.3.16.3-all .不摆了.看哈就会下载了. 2 . 解压 后 找到 apps 文件夹. 3. 打开后将 struts2-blank.war ...
- 写一个程序可以对两个字符串进行测试,得知第一个字符串是否包含在第二个字符串中。如字符串”PEN”包含在字符串“INDEPENDENT”中。
package lovo.test; import java.util.Scanner; public class Java { @param args public static void main ...
- Xcode中的Version和Build的区别
Version( 应用程序发布版本号 ) Version对应的是CFBundleShortVersionString. Version 一般由产品部门确定,版本号是由分隔的整数组成的字符串,一般有2段 ...
- PowerMockito 同时mock多个对象
有时候,需要测试的方法内有collections结构,就需要同时mock多个对象 被测方法: public class EmployeeService { public List<Integer ...
- LLDB, iOS调试器
breakpoint set -s "" breakpoint set -M <method> ( --method <method> ) -S ...
- selenium+python+eclipse开发中遇到的问题
1.中文编码问题 报错提示:SyntaxError: Non-ASCII character '\xba' in file D:\autotest\PythonCase\src\selenium\te ...
- JavaScript中style, currentStyle和 getComputedStyle的异同
今天在做项目的时候,习惯性的用到了element.style.width,然而浏览器却报错,错误提示是style is undefined,这是我才意识到,内联样式表和外联样式表在js应用中也有很大的 ...
- [转载] javascript实现深度克隆
js一般有两种不同数据类型的值: 基本类型(包括undefined,Null,boolean,String,Number),按值传递: 引用类型(包括数组,对象),按址传递,引用类型在值传递的时候是内 ...
- jQuery原生框架-----------------dom操作
// 扩展DOM操作方法jQuery.fn.extend({ // 设置或者获取元素的内容 html: function( html ) { /* * 实现思路: * 1.不传参,返回第一个元素的内容 ...