yum安裝php7

PHP 7.0 on CentOS/RHEL 6.8 and 7.2 via Yum

PHP 7.0.11 has been released on PHP.net on 15th September 2016, and is also available for CentOS/RHEL 6.8 and 7.2 at Webtatic via Yum.
PEAR installer now supports PHP 7.0, however most pecl libraries will not support it as well without their maintainers adding compatibility, so only pecl libraries that do support it will be in the Webtatic repository.
pecl memcache extension – no sign of PHP 7 support development in official source repository
pecl memcached extension – PHP 7 support is still in development, and no pre-releases available

PHP 7.0.0 comes with new version of the Zend Engine with features such as (incomplete list):
Improved performance: PHP 7 is up to twice as fast as PHP 5.6
Consistent 64-bit support
Many fatal errors are now Exceptions
Removal of old and unsupported SAPIs and extensions
The null coalescing operator (??)
Combined comparison Operator (<=>)
Return Type Declarations
Scalar Type Declarations
Anonymous Classes

To see what else has been added, check out the Migrating from PHP 5.6.x to PHP 7.0.x.
To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:
CentOS/RHEL 7.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Now you can install PHP 7.0’s mod_php SAPI (along with an opcode cache) by doing:
yum install php70w php70w-opcache

You can alternatively install PHP 7.0’s php-fpm SAPI (along with an opcode cache by doing:
yum install php70w-fpm php70w-opcache

See the package list below for additional SAPIs and PHP extensions.
This will install the mod_php SAPI for PHP, however there are other sapis such as php-fpm (via php70w-fpm package). Read on below for more information about the available SAPIs
If you would like to upgrade php to this version it is recommended that you first check that your system will support the upgrade, e.g. making sure any CPanel-like software can run after the upgrade.
Unless you know what you are doing, it is risky upgrading an existing system. It’s much safer to do this by provisioning a separate server to perform the upgrade as a fresh install instead.
If you know what you are doing, you can upgrade PHP by:
yum install yum-plugin-replace yum replace php-common --replace-with=php70w-common

It will likely give you a message “WARNING: Unable to resolve all providers …”. This is normal, and you can continue by tying “y“. You will be given a chance to see what packages will be installed and removed before again being given a chance to confirm.

SAPIs – different runtime environments of PHP
mod_php NTS
(non-thread safety) Contained in the php70w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd prefork mpm (the default mode httpd is ran under. It is not thread-safe, but doesn’t need to be due to prefork not using threads. It’s located at /usr/lib[64]/httpd/modules/libphp7.so
cli
Contained in the php70w-cli package, this SAPI allows running scripts from the command-line, and also has a built-in web server for development-use. Located at /usr/bin/php
fpm
Contained in the php70w-fpm package, fpm (FastCGI Process Manager) is a scalable FastCGI process, which acts similar to how Httpd prefork mpm works managing it’s forks. Located at /usr/sbin/php-fpm, it is controlled using the /etc/init.d/php-fpm service script
phpdbg
Contained in the php70w-phpdbg package, phpdbg has the ability to debug scripts using breakpoints from the command-line, and also supports remote-debugging using an external Java client for remote communication.
embedded
Contained in the php70w-embedded package, this SAPI allows embedding PHP in other applications. It’s library is located at /usr/lib[64]/libphp7.so
cgi, fastcgi
Contained in the php70w-cli package, these SAPIs are not recommended for use, but are available where needed. They both exist in the binary at /usr/bin/php-cgi.
mod_php TS
(thread safety) Contained in the php70w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd worker mpm. It’s supposed to be thread-safe, but can’t guarantee to be, and certainly not under additional PHP extensions. It’s better to use FastCGI SAPIs than this one. It’s located at /usr/lib[64]/httpd/modules/libphp7-zts.so

Packages
Package
Provides

php70w
mod_php, php70w-zts

php70w-bcmath

php70w-cli
php-cgi, php-pcntl, php-readline

php70w-common
php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib

php70w-dba

php70w-devel

php70w-embedded
php-embedded-devel

php70w-enchant

php70w-fpm

php70w-gd

php70w-imap

php70w-interbase
php_database, php-firebird

php70w-intl

php70w-ldap

php70w-mbstring

php70w-mcrypt

php70w-mysql
php-mysqli, php_database

php70w-mysqlnd
php-mysqli, php_database

php70w-odbc
php-pdo_odbc, php_database

php70w-opcache
php70w-pecl-zendopcache

php70w-pdo
php70w-pdo_sqlite, php70w-sqlite3

php70w-pdo_dblib
php70w-mssql

php70w-pear

php70w-pecl-apcu

php70w-pecl-imagick

php70w-pecl-redis

php70w-pecl-xdebug

php70w-pgsql
php-pdo_pgsql, php_database

php70w-phpdbg

php70w-process
php-posix, php-sysvmsg, php-sysvsem, php-sysvshm

php70w-pspell

php70w-recode

php70w-snmp

php70w-soap

php70w-tidy

php70w-xml
php-dom, php-domxml, php-wddx, php-xsl

php70w-xmlrpc

Opcode Caches
The PHP distribution now comes with an opcode cache. This is the Zend Optimizer+ opcode cache, now known as the Zend OPcache extension. This extension is optional, so does not preclude you from using an alternate one.
Due to it being included in the PHP source distribution, it will be well maintained and more suitable for use while other Opcode cache’s are being updated over the coming months.
yum install php70w-opcache

error_reporting E_ALL includes E_STRICT
As mentioned in the PHP 5.4 guide:
You may get a lot more errors coming out of your error logs if by default your error_reporting is set to E_ALL now without explicitly turning off E_STRICT. The default php.ini that comes with the PHP package turns this off by default, but if you are upgrading from an existing installation, your php.ini may not be updated, meaning this will likely be turned on.

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市难裆,隨后出現的幾起案子,更是在濱河造成了極大的恐慌不同,老刑警劉巖窟却,帶你破解...
    沈念sama閱讀 217,509評論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件瞬欧,死亡現場離奇詭異水慨,居然都是意外死亡湿颅,警方通過查閱死者的電腦和手機蔚叨,發(fā)現死者居然都...
    沈念sama閱讀 92,806評論 3 394
  • 文/潘曉璐 我一進店門床蜘,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人蔑水,你說我怎么就攤上這事邢锯。” “怎么了搀别?”我有些...
    開封第一講書人閱讀 163,875評論 0 354
  • 文/不壞的土叔 我叫張陵丹擎,是天一觀的道長。 經常有香客問我歇父,道長蒂培,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,441評論 1 293
  • 正文 為了忘掉前任榜苫,我火速辦了婚禮护戳,結果婚禮上,老公的妹妹穿的比我還像新娘垂睬。我一直安慰自己媳荒,他們只是感情好抗悍,可當我...
    茶點故事閱讀 67,488評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著钳枕,像睡著了一般缴渊。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上鱼炒,一...
    開封第一講書人閱讀 51,365評論 1 302
  • 那天衔沼,我揣著相機與錄音,去河邊找鬼田柔。 笑死俐巴,一個胖子當著我的面吹牛,可吹牛的內容都是我干的硬爆。 我是一名探鬼主播欣舵,決...
    沈念sama閱讀 40,190評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼缀磕!你這毒婦竟也來了缘圈?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 39,062評論 0 276
  • 序言:老撾萬榮一對情侶失蹤袜蚕,失蹤者是張志新(化名)和其女友劉穎糟把,沒想到半個月后,有當地人在樹林里發(fā)現了一具尸體牲剃,經...
    沈念sama閱讀 45,500評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡遣疯,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,706評論 3 335
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現自己被綠了凿傅。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片缠犀。...
    茶點故事閱讀 39,834評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖聪舒,靈堂內的尸體忽然破棺而出辨液,到底是詐尸還是另有隱情,我是刑警寧澤箱残,帶...
    沈念sama閱讀 35,559評論 5 345
  • 正文 年R本政府宣布滔迈,位于F島的核電站,受9級特大地震影響被辑,放射性物質發(fā)生泄漏燎悍。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,167評論 3 328
  • 文/蒙蒙 一敷待、第九天 我趴在偏房一處隱蔽的房頂上張望间涵。 院中可真熱鬧,春花似錦榜揖、人聲如沸勾哩。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,779評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽思劳。三九已至迅矛,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間潜叛,已是汗流浹背秽褒。 一陣腳步聲響...
    開封第一講書人閱讀 32,912評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留威兜,地道東北人销斟。 一個月前我還...
    沈念sama閱讀 47,958評論 2 370
  • 正文 我出身青樓,卻偏偏與公主長得像椒舵,于是被迫代替她去往敵國和親蚂踊。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 44,779評論 2 354

推薦閱讀更多精彩內容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,471評論 5 6
  • 自定義數據類型的使用3.1 辨析成員變量與方法參數的設計定義? 定義長方形類笔宿,包含求周長與求面積的方法? ...
    葡小萄家的貓閱讀 562評論 0 0
  • ?其實泼橘,你只是嫌生活枯燥罷了 1 在一些小報雜志和網站上涝动,總能看見一些有關心理健康的測試題。雖然不排除有一部分是科...
    溫柔的晚風閱讀 265評論 0 0
  • 那些櫻花樹下 死去的夢 和斷腳的天 一拗一拗 不必睜開眼睛 你也知道 夜晚還很遠 雨卻不停 截一段肋骨 做個男人 ...
    雨子1983閱讀 150評論 0 0
  • 回憶里的一首詩炬灭, 哀怨啼鳴的讓人失去了全身的力氣醋粟。 突然掉了線, 迷了途重归。 未來的你是不是一曲唱不完的離歌昔穴, 藏有...
    阿俊xi閱讀 183評論 0 4