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