CentOS 7 使用 yum 安装 PHP 5.6.x

2021-05-29 21:00

阅读:507

标签:oca   成功   quick   efi   span   yum安装   exif   red   $1   

系统版本:

[root@localhost modules]# rpm -q centos-release
centos-release-7-5.1804.el7.centos.x86_64

 

一、yum安装PHP

1.检查当前安装的PHP包

yum list installed | grep php

如果有安装的PHP包,先删除他们

yum list installed | grep php | awk {print $1} | yum remove

 

2.配置epel源

yum install -y epel-release
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

配置remi源

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

使用yum list命令查看可安装的包(Packege)

yum list --enablerepo=remi --enablerepo=remi-php56 | grep ‘@remi-php56‘

 

3.安装php5.6.x

yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-pear php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof --skip-broken

 

4.安装php-fpm

yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm 

 

5.配置开机启动服务

systemctl enable php-fpm

 

6.启动php-fpm

systemctl restart php-fpm

 

7.查看是否安装成功

ps -ef | grep php
netstat -anp | grep 9000

 

安装其他扩展

yum install --enablerepo=remi --enablerepo=remi-php56 php-扩展名称 php-扩展名称2

支持的扩展列表:

技术图片技术图片
bcmath
bz2
calendar
crypto
ctype
curl
dbase
dba
dom
exif
fileinfo
ftp
gd
geoip
gettext
iconv
igbinary
imap
interbase
json
ldap
lua
mbstring
mcrypt
memcached
mongo
msgpack
mysqli
mysqlnd
mysql
oauth
odbc
opcache
pdo_firebird
pdo_mysql
pdo_odbc
pdo
pdo_sqlite
phar
posix
quickhash
recode
redis
rrd
seaslog
shmop
simplexml
snmp
soap
sockets
solr
sphinx
sqlite3
sqlite
ssh2
stomp
svn
sync
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
trader
wddx
xdebug
xhprof
xmldiff
xmlreader
xml
xmlwriter
xsl
yaf
yaml
yar
yaz
zip
View Code

 

8.查看PHP版本

[root@localhost modules]# php -v
PHP 5.6.40 (cli) (built: Feb  3 2021 11:47:03)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

 

二、安装AMQP扩展

1.安装rabbitmq-c

下载地址:http://github.com/alanxz/rabbitmq-c
选择的版本是0.8.0,从0.9.0开始编译模式换成了CMake

[root@localhost ~]# wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
[root@localhost ~]# tar zxf rabbitmq-c-0.8.0.tar.gz
[root@localhost ~]# cd rabbitmq-c-0.8.0
[root@localhost ~]# ./configure --prefix=/usr/local/rabbitmq-c-0.8.0
[root@localhost ~]# make && make install

 

2.安装AMQP

下载地址https://pecl.php.net/package/amqp
选择的是最新版1.10.2

[root@localhost ~]# wget https://pecl.php.net/get/amqp-1.10.2.tgz
[root@localhost ~]# tar zxf amqp-1.10.2.tgz
[root@localhost ~]# cd amqp-1.10.2
[root@localhost ~]# /usr/local/php/bin/phpize
[root@localhost ~]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0
[root@localhost ~]# make && make install

注意:这里的/usr/local/rabbitmq-c-0.8.0要跟上面rabbitmq-c安装的地址一样

 

3.添加AMQP扩展

vim /etc/php.ini

添加一行

extension=amqp.so

重启php

service php-fpm restart

 

4.检查amqp安装

[root@localhost modules]# php -m
[PHP Modules]
amqp
bcmath
bz2
calendar

 

 

 

PS:

CentOS 7使用yum安装PHP5.6

PHP安装AMQP扩展

 

CentOS 7 使用 yum 安装 PHP 5.6.x

标签:oca   成功   quick   efi   span   yum安装   exif   red   $1   

原文地址:https://www.cnblogs.com/phpdragon/p/14710830.html


评论


亲,登录后才可以留言!