在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0

PHP是一种为我们熟知的通用服务器网页脚本语言。非常多的在线网站都是用PHP编写的。PHP这些年来一直在持续进化,丰富其功能,变得易于使用,更好地组织的脚本语言。目前PHP的开发团队正筹备下一个PHP版本的发行,名字是PHP 7。现在的PHP版本为PHP 5.6,可能你清楚PHP 6已经流产了,PHP 7的支持者们不希望下一个重要的版本被其他分支混淆,即过去已经停止很久的PHP 6。所以决定下一个PHP主要的发行版本叫PHP 7,而不是PHP 6。PHP 7.0预计在今年十一月份发行。

在下一代主要PHP版本里有一些不错的功能:

  • 为了改善执行效率与内存占用,新的版本添加了PHPNG功能。
  • 引入了JIT引擎来动态编译Zend操作码为自然机器码,以此来达到更快的处理性能。这项功能允许随后的程序调用同一份代码,这样会运行快很多。
  • AST(抽象语法树)是最新添加的功能,它可以增强支持PHP的扩展性和用户应用。
  • 添加异步编程功能以支持同一个请求中的并行任务。
  • 新的版本会支持独立的多线程网页服务器,这样可以使用一个单独的存储池处理很多并发的请求。

在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0

 

在CentOS/Fedora上安装PHP 7

让我们来看看怎样在CentOS 7和Fedora 21安装PHP7。为了安装PHP7,我们首先需要克隆php-src 仓库。当克隆工作完成,我们再配置和编译它。进行下一步之前,我们要确保已经在LInux系统下安装了如下的组件,否则PHP编译会返回错误中止。

  • Git
  • autoconf
  • gcc
  • bison

所有上面提到的要求可以使用Yum软件包管理器安装。以下一条命令即可完成:

  1. <span class="pln">yum install git autoconf gcc bison</span>

准备好开始安装PHP7了吗?让我们先创建一个PHP7目录,作为你的当前工作目录。

  1. <span class="pln">mkdir php7</span>
  2. <span class="pln">cd php7</span>

现在克隆php-src仓库,在终端里运行下面的命令。

  1. <span class="pln">git clone https</span><span class="pun">:</span><span class="com">//git.php.net/repository/php-src.git</span>

工作应该会在几分钟后完成,这里是一个样例输出,你应该会在任务完成时看见。

  1. <span class="pun">[</span><span class="pln">root@localhost php7</span><span class="pun">]#</span><span class="pln"> git clone https</span><span class="pun">:</span><span class="com">//git.php.net/repository/php-src.git</span>
  2. <span class="typ">Cloning</span><span class="kwd">into</span><span class="str">'php-src'</span><span class="pun">...</span>
  3. <span class="pln">remote</span><span class="pun">:</span><span class="typ">Counting</span><span class="pln"> objects</span><span class="pun">:</span><span class="lit">615064</span><span class="pun">,</span><span class="kwd">done</span><span class="pun">.</span>
  4. <span class="pln">remote</span><span class="pun">:</span><span class="typ">Compressing</span><span class="pln"> objects</span><span class="pun">:</span><span class="lit">100</span><span class="pun">%</span><span class="pun">(</span><span class="lit">127800</span><span class="pun">/</span><span class="lit">127800</span><span class="pun">),</span><span class="kwd">done</span><span class="pun">.</span>
  5. <span class="pln">remote</span><span class="pun">:</span><span class="typ">Total</span><span class="lit">615064</span><span class="pun">(</span><span class="pln">delta </span><span class="lit">492063</span><span class="pun">),</span><span class="pln"> reused </span><span class="lit">608718</span><span class="pun">(</span><span class="pln">delta </span><span class="lit">485944</span><span class="pun">)</span>
  6. <span class="typ">Receiving</span><span class="pln"> objects</span><span class="pun">:</span><span class="lit">100</span><span class="pun">%</span><span class="pun">(</span><span class="lit">615064</span><span class="pun">/</span><span class="lit">615064</span><span class="pun">),</span><span class="lit">152.32</span><span class="typ">MiB</span><span class="pun">|</span><span class="lit">16.97</span><span class="typ">MiB</span><span class="pun">/</span><span class="pln">s</span><span class="pun">,</span><span class="kwd">done</span><span class="pun">.</span>
  7. <span class="typ">Resolving</span><span class="pln"> deltas</span><span class="pun">:</span><span class="lit">100</span><span class="pun">%</span><span class="pun">(</span><span class="lit">492063</span><span class="pun">/</span><span class="lit">492063</span><span class="pun">),</span><span class="kwd">done</span><span class="pun">.</span>

让我们来配置,编译PHP7,在终端运行下面的命令,开始配置工作:

  1. <span class="pln">cd php</span><span class="pun">-</span><span class="pln">src</span>
  2. <span class="pun">./</span><span class="pln">buildconf</span>

下面是./buildconf命令的样例输出。

  1. <span class="pun">[</span><span class="pln">root@localhost php</span><span class="pun">-</span><span class="pln">src</span><span class="pun">]#</span><span class="pun">./</span><span class="pln">buildconf</span>
  2. <span class="pln">buildconf</span><span class="pun">:</span><span class="pln"> checking installation</span><span class="pun">...</span>
  3. <span class="pln">buildconf</span><span class="pun">:</span><span class="pln"> autoconf version </span><span class="lit">2.69</span><span class="pun">(</span><span class="pln">ok</span><span class="pun">)</span>
  4. <span class="pln">rebuilding aclocal</span><span class="pun">.</span><span class="pln">m4</span>
  5. <span class="pln">rebuilding configure</span>
  6. <span class="pln">rebuilding main</span><span class="pun">/</span><span class="pln">php_config</span><span class="pun">.</span><span class="pln">h</span><span class="pun">.</span><span class="kwd">in</span>

使用下面的命令,继续配置进程:

  1. <span class="pun">./</span><span class="pln">configure \</span>
  2. <span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="pln">$HOME</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr \</span>
  3. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">config</span><span class="pun">-</span><span class="pln">file</span><span class="pun">-</span><span class="pln">path</span><span class="pun">=</span><span class="pln">$HOME</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">etc \</span>
  4. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">mbstring \</span>
  5. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">zip \</span>
  6. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">bcmath \</span>
  7. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">pcntl \</span>
  8. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">ftp \</span>
  9. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">exif \</span>
  10. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">calendar \</span>
  11. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">sysvmsg \</span>
  12. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">sysvsem \</span>
  13. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">sysvshm \</span>
  14. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">wddx \</span>
  15. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">curl \</span>
  16. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">mcrypt \</span>
  17. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">iconv \</span>
  18. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">gmp \</span>
  19. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">pspell \</span>
  20. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">gd \</span>
  21. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">jpeg</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=/</span><span class="pln">usr \</span>
  22. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">png</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=/</span><span class="pln">usr \</span>
  23. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">zlib</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=/</span><span class="pln">usr \</span>
  24. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">xpm</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=/</span><span class="pln">usr \</span>
  25. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">freetype</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=/</span><span class="pln">usr \</span>
  26. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">t1lib</span><span class="pun">=/</span><span class="pln">usr \</span>
  27. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">gd</span><span class="pun">-</span><span class="kwd">native</span><span class="pun">-</span><span class="pln">ttf \</span>
  28. <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">gd</span><span class="pun">-</span><span class="pln">jis</span><span class="pun">-</span><span class="pln">conv \</span>
  29. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">openssl \</span>
  30. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">mysql</span><span class="pun">=/</span><span class="pln">usr \</span>
  31. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">pdo</span><span class="pun">-</span><span class="pln">mysql</span><span class="pun">=/</span><span class="pln">usr \</span>
  32. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">gettext</span><span class="pun">=/</span><span class="pln">usr \</span>
  33. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">zlib</span><span class="pun">=/</span><span class="pln">usr \</span>
  34. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">bz2</span><span class="pun">=/</span><span class="pln">usr \</span>
  35. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">recode</span><span class="pun">=/</span><span class="pln">usr \</span>
  36. <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">mysqli</span><span class="pun">=</span><span class="str">/usr/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysql_config</span>

这会花去不少的时间,当完成后你应该会看到如下面的输出:

  1. <span class="pln">creating libtool</span>
  2. <span class="pln">appending configuration tag </span><span class="str">"CXX"</span><span class="pln"> to libtool</span>
  3. <span class="typ">Generating</span><span class="pln"> files</span>
  4. <span class="pln">configure</span><span class="pun">:</span><span class="pln"> creating </span><span class="pun">./</span><span class="pln">config</span><span class="pun">.</span><span class="pln">status</span>
  5. <span class="pln">creating main</span><span class="pun">/</span><span class="pln">internal_functions</span><span class="pun">.</span><span class="pln">c</span>
  6. <span class="pln">creating main</span><span class="pun">/</span><span class="pln">internal_functions_cli</span><span class="pun">.</span><span class="pln">c</span>
  7. <span class="pun">+--------------------------------------------------------------------+</span>
  8. <span class="pun">|</span><span class="typ">License</span><span class="pun">:</span><span class="pun">|</span>
  9. <span class="pun">|</span><span class="typ">This</span><span class="pln"> software </span><span class="kwd">is</span><span class="pln"> subject to the PHP </span><span class="typ">License</span><span class="pun">,</span><span class="pln"> available </span><span class="kwd">in</span><span class="kwd">this</span><span class="pun">|</span>
  10. <span class="pun">|</span><span class="pln"> distribution </span><span class="kwd">in</span><span class="pln"> the file LICENSE</span><span class="pun">.</span><span class="typ">By</span><span class="pln"> continuing </span><span class="kwd">this</span><span class="pln"> installation </span><span class="pun">|</span>
  11. <span class="pun">|</span><span class="pln"> process</span><span class="pun">,</span><span class="pln"> you are bound </span><span class="kwd">by</span><span class="pln"> the terms of </span><span class="kwd">this</span><span class="pln"> license agreement</span><span class="pun">.</span><span class="pun">|</span>
  12. <span class="pun">|</span><span class="typ">If</span><span class="pln"> you </span><span class="kwd">do</span><span class="kwd">not</span><span class="pln"> agree </span><span class="kwd">with</span><span class="pln"> the terms of </span><span class="kwd">this</span><span class="pln"> license</span><span class="pun">,</span><span class="pln"> you must abort </span><span class="pun">|</span>
  13. <span class="pun">|</span><span class="pln"> the installation process at </span><span class="kwd">this</span><span class="pln"> point</span><span class="pun">.</span><span class="pun">|</span>
  14. <span class="pun">+--------------------------------------------------------------------+</span>
  15. <span class="typ">Thank</span><span class="pln"> you </span><span class="kwd">for</span><span class="kwd">using</span><span class="pln"> PHP</span><span class="pun">.</span>
  16. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating php7</span><span class="pun">.</span><span class="pln">spec</span>
  17. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating main</span><span class="pun">/</span><span class="pln">build</span><span class="pun">-</span><span class="pln">defs</span><span class="pun">.</span><span class="pln">h</span>
  18. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating scripts</span><span class="pun">/</span><span class="pln">phpize</span>
  19. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating scripts</span><span class="pun">/</span><span class="pln">man1</span><span class="pun">/</span><span class="pln">phpize</span><span class="pun">.</span><span class="lit">1</span>
  20. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating scripts</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">config</span>
  21. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating scripts</span><span class="pun">/</span><span class="pln">man1</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">config</span><span class="pun">.</span><span class="lit">1</span>
  22. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating sapi</span><span class="pun">/</span><span class="pln">cli</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="lit">1</span>
  23. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating sapi</span><span class="pun">/</span><span class="pln">cgi</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">cgi</span><span class="pun">.</span><span class="lit">1</span>
  24. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating ext</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">.</span><span class="lit">1</span>
  25. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating ext</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">.</span><span class="pln">phar</span><span class="pun">.</span><span class="lit">1</span>
  26. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> creating main</span><span class="pun">/</span><span class="pln">php_config</span><span class="pun">.</span><span class="pln">h</span>
  27. <span class="pln">config</span><span class="pun">.</span><span class="pln">status</span><span class="pun">:</span><span class="pln"> executing </span><span class="kwd">default</span><span class="pln"> commands</span>

运行下面的命令,完成编译过程。

  1. <span class="pln">make</span>

“make”命令的样例输出如下所示:

  1. <span class="typ">Generating</span><span class="pln"> phar</span><span class="pun">.</span><span class="pln">php</span>
  2. <span class="typ">Generating</span><span class="pln"> phar</span><span class="pun">.</span><span class="pln">phar</span>
  3. <span class="pln">PEAR </span><span class="kwd">package</span><span class="pln"> PHP_Archive </span><span class="kwd">not</span><span class="pln"> installed</span><span class="pun">:</span><span class="pln"> generated phar will </span><span class="kwd">require</span><span class="pln"> PHP</span><span class="str">'s phar extension be enabled.</span>
  4. <span class="str">clicommand.inc</span>
  5. <span class="str">directorytreeiterator.inc</span>
  6. <span class="str">directorygraphiterator.inc</span>
  7. <span class="str">pharcommand.inc</span>
  8. <span class="str">invertedregexiterator.inc</span>
  9. <span class="str">phar.inc</span>
  10. <span class="str">Build complete.</span>
  11. <span class="str">Don'</span><span class="pln">t forget to run </span><span class="str">'make test'</span><span class="pun">.</span>

活儿干完了,该安装PHP7了,运行下面的命令安装它。

  1. <span class="pln">make install</span>

成功安装的进程的样例输出应该像这样:

  1. <span class="pun">[</span><span class="pln">root@localhost php</span><span class="pun">-</span><span class="pln">src</span><span class="pun">]#</span><span class="pln"> make install</span>
  2. <span class="typ">Installing</span><span class="pln"> shared extensions</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">extensions</span><span class="pun">/</span><span class="kwd">no</span><span class="pun">-</span><span class="pln">debug</span><span class="pun">-</span><span class="pln">non</span><span class="pun">-</span><span class="pln">zts</span><span class="pun">-</span><span class="lit">20141001</span><span class="pun">/</span>
  3. <span class="typ">Installing</span><span class="pln"> PHP CLI binary</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span>
  4. <span class="typ">Installing</span><span class="pln"> PHP CLI man page</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">man</span><span class="pun">/</span><span class="pln">man1</span><span class="pun">/</span>
  5. <span class="typ">Installing</span><span class="pln"> PHP CGI binary</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span>
  6. <span class="typ">Installing</span><span class="pln"> PHP CGI man page</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">man</span><span class="pun">/</span><span class="pln">man1</span><span class="pun">/</span>
  7. <span class="typ">Installing</span><span class="pln"> build environment</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">build</span><span class="pun">/</span>
  8. <span class="typ">Installing</span><span class="pln"> header files</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span>
  9. <span class="typ">Installing</span><span class="pln"> helper programs</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span>
  10. <span class="pln">program</span><span class="pun">:</span><span class="pln"> phpize</span>
  11. <span class="pln">program</span><span class="pun">:</span><span class="pln"> php</span><span class="pun">-</span><span class="pln">config</span>
  12. <span class="typ">Installing</span><span class="pln"> man pages</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">man</span><span class="pun">/</span><span class="pln">man1</span><span class="pun">/</span>
  13. <span class="pln">page</span><span class="pun">:</span><span class="pln"> phpize</span><span class="pun">.</span><span class="lit">1</span>
  14. <span class="pln">page</span><span class="pun">:</span><span class="pln"> php</span><span class="pun">-</span><span class="pln">config</span><span class="pun">.</span><span class="lit">1</span>
  15. <span class="typ">Installing</span><span class="pln"> PEAR environment</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span>
  16. <span class="pun">[</span><span class="pln">PEAR</span><span class="pun">]</span><span class="typ">Archive_Tar</span><span class="pun">-</span><span class="pln"> installed</span><span class="pun">:</span><span class="lit">1.3</span><span class="pun">.</span><span class="lit">13</span>
  17. <span class="pun">[</span><span class="pln">PEAR</span><span class="pun">]</span><span class="typ">Console_Getopt</span><span class="pun">-</span><span class="pln"> installed</span><span class="pun">:</span><span class="lit">1.3</span><span class="pun">.</span><span class="lit">1</span>
  18. <span class="pun">[</span><span class="pln">PEAR</span><span class="pun">]</span><span class="typ">Structures_Graph</span><span class="pun">-</span><span class="pln"> installed</span><span class="pun">:</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">4</span>
  19. <span class="pun">[</span><span class="pln">PEAR</span><span class="pun">]</span><span class="pln"> XML_Util </span><span class="pun">-</span><span class="pln"> installed</span><span class="pun">:</span><span class="lit">1.2</span><span class="pun">.</span><span class="lit">3</span>
  20. <span class="pun">[</span><span class="pln">PEAR</span><span class="pun">]</span><span class="pln"> PEAR </span><span class="pun">-</span><span class="pln"> installed</span><span class="pun">:</span><span class="lit">1.9</span><span class="pun">.</span><span class="lit">5</span>
  21. <span class="typ">Wrote</span><span class="pln"> PEAR system config file at</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">pear</span><span class="pun">.</span><span class="pln">conf</span>
  22. <span class="typ">You</span><span class="pln"> may want to add</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">php to your php</span><span class="pun">.</span><span class="pln">ini include_path</span>
  23. <span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">src</span><span class="pun">/</span><span class="pln">build</span><span class="pun">/</span><span class="pln">shtool install </span><span class="pun">-</span><span class="pln">c ext</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">.</span><span class="pln">phar </span><span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span>
  24. <span class="pln">ln </span><span class="pun">-</span><span class="pln">s </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">phar</span><span class="pun">.</span><span class="pln">phar </span><span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">phar</span>
  25. <span class="typ">Installing</span><span class="pln"> PDO headers</span><span class="pun">:</span><span class="str">/root/</span><span class="pln">php7</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">ext</span><span class="pun">/</span><span class="pln">pdo</span><span class="pun">/</span>

恭喜你,PHP7已经安装在你的Linux系统上了。安装完后,进入PHP7安装文件里的sapi/cli里面。

  1. <span class="pln">cd sapi</span><span class="pun">/</span><span class="pln">cli</span>

验证一下PHP的版本。

  1. <span class="pun">[</span><span class="pln">root@localhost cli</span><span class="pun">]#</span><span class="pun">./</span><span class="pln">php </span><span class="pun">-</span><span class="pln">v</span>
  2. <span class="pln">PHP </span><span class="lit">7.0</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="pln">dev </span><span class="pun">(</span><span class="pln">cli</span><span class="pun">)</span><span class="pun">(</span><span class="pln">built</span><span class="pun">:</span><span class="typ">Mar</span><span class="lit">28</span><span class="lit">2015</span><span class="lit">00</span><span class="pun">:</span><span class="lit">54</span><span class="pun">:</span><span class="lit">11</span><span class="pun">)</span>
  3. <span class="typ">Copyright</span><span class="pun">(</span><span class="pln">c</span><span class="pun">)</span><span class="lit">1997</span><span class="pun">-</span><span class="lit">2015</span><span class="typ">The</span><span class="pln"> PHP </span><span class="typ">Group</span>
  4. <span class="typ">Zend</span><span class="typ">Engine</span><span class="pln"> v3</span><span class="pun">.</span><span class="lit">0.0</span><span class="pun">-</span><span class="pln">dev</span><span class="pun">,</span><span class="typ">Copyright</span><span class="pun">(</span><span class="pln">c</span><span class="pun">)</span><span class="lit">1998</span><span class="pun">-</span><span class="lit">2015</span><span class="typ">Zend</span><span class="typ">Technologies</span>

 

总结

PHP 7也添加到了remi仓库,这个即将到来的版本主要关注执行效率的提升,它的新特性致力于使PHP较好满足现代编程的需求和趋势。PHP 7.0将会有许多新的特性、丢弃一些老版本的东西。在接下来的日子里,我们希望看到新特性和弃用功能的具体情况。希望你喜欢!

PHP 的详细介绍:请点这里
PHP 的下载地址:请点这里


via: http://linoxide.com/linux-how-to/install-php-7-centos-7-fedora-21/

作者:Aun Raza 译者:wi-cuckoo 校对:wxy

本文由 LCTT 原创翻译,Linux中国 荣誉推出

来源:http://linux.cn/article-5501-1.html

相关推荐