yum安装php7.2

Posted 小田吃饺子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了yum安装php7.2相关的知识,希望对你有一定的参考价值。

文章来源:https://www.cnblogs.com/hello-tl/p/9404655.html 

分享一个算是比较完美的php7.2yum安装

0.更换yum原

# yum install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

1.安装php

# yum install php72w

2.安装php扩展根据自己需求来

php72w-cli 
php72w-common 
php72w-devel 
php72w-embedded 
php72w-fpm 
php72w-gd 
php72w-mbstring 
php72w-mysqlnd 
php72w-opcache 
php72w-pdo 
php72w-xml 
php72w 
php72w-bcmath 
php72w-dba 
php72w-enchant 
php72w-imap 
php72w-interbase
php72w-intl 
php72w-ldap  
php72w-mcrypt 
php72w-odbc 
php72w-pdo_dblib 
php72w-pear 
php72w-pecl-apcu 
php72w-pecl-imagick 
php72w-pecl-xdebug 
php72w-pgsql 
php72w-phpdbg 
php72w-process 
php72w-pspell 
php72w-recode 
php72w-snmp 
php72w-soap 
php72w-tidy 
php72w-xmlrpc 
php72w-pecl-igbinary 
php72w-intl 
php72w-memcached 
php72w-pecl-mongodb

3.查看php版本

[root@php ~]# php -v
PHP 7.2.7 (cli) (built: Jul  1 2018 08:22:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

4.配置文件所在地址

php.ini             /etc/php.ini
php加载ini文件       /etc/php.d/*.ini
php-fpm.conf        /etc/php-fpm.conf    
php-fpm.pid         /var/run/php-fpm/php-fpm.pid
php-fpm启动          php-fpm

5.扩展swoole

1)安装依赖包

# yum -y install postgresql-devel
 
# yum install glibc-headers gcc-c++ git-core gcc autoconf cmake libcurl4-openssl-dev openssl libssl-dev build-essential zlibc zlib-bin libidn11-dev libidn11 minizip openssl-devel

下载nghttp2依赖
# wget nghttp2下载地址
# tar -zxvf nghttp2
# cd nghttp2
# ./configure
# make
# make install

下载hiredis依赖
# wget hiredis下载地址
# tar -zxvf hiredis
# cd hiredis
# make
# make install

2)安装swoole

# pecl install swoole

3)根据自己的情况来选择yes or no 本次示范全部选为yes

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading swoole-4.0.3.tgz ...
Starting to download swoole-4.0.3.tgz (903,874 bytes)
.........................................done: 903,874 bytes
304 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
enable debug/trace log support? [no] : yes
enable sockets supports? [no] : yes
enable openssl support? [no] : yes
enable http2 support? [no] : yes
enable async-redis support? [no] : yes
enable mysqlnd support? [no] : yes
enable postgresql coroutine client support? [no] : 

4.安装完成

Build complete.
Don\'t forget to run \'make test\'.

running: make INSTALL_ROOT="/var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3" install
Installing shared extensions:     /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/lib64/php/modules/
Installing header files:          /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php/
running: find "/var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3" | xargs ls -dils
266121     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3
266172     4 drwxr-xr-x 4 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr
526626     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include
526627     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php
526628     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php/ext
526629     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php/ext/swoole
526631     8 -rw-r--r-- 1 root root     4300 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php/ext/swoole/config.h
526630     4 drwxr-xr-x 2 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/include/php/ext/swoole/include
526623     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/lib64
526624     4 drwxr-xr-x 3 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/lib64/php
526625     4 drwxr-xr-x 2 root root     4096 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/lib64/php/modules
526622 12268 -rwxr-xr-x 1 root root 12560576 Aug  1 23:00 /var/tmp/pear-build-rootPmvfF4/install-swoole-4.0.3/usr/lib64/php/modules/swoole.so

Build process completed successfully
Installing \'/usr/lib64/php/modules/swoole.so\'
Installing \'/usr/include/php/ext/swoole/config.h\'
install ok: channel://pecl.php.net/swoole-4.0.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=swoole.so" to php.ini

5.加入swoole.so加入ini

在 /etc/php.d/下新建并并写入
# vim /etc/php.d/swoole.ini
    ; Enable swoole extension module
    extension=swoole.so
:wq

6.查看php扩展

[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
enchant
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imagick
imap
intl
json
ldap
libxml
mbstring
memcached
mongodb
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
readline
recode
redis
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

文章来源:https://www.cnblogs.com/hello-tl/p/9404655.html 

以上是关于yum安装php7.2的主要内容,如果未能解决你的问题,请参考以下文章

yum安装php7.2

contos7 yum安装php7.2与swoole

Centos7 离线安装 php7

yum安装Zabbix5.0+Nginx+Php7.2

Centos7使用yum安装PHP7.2

php7.2 安装bcmath扩展