CentOS装置php的步骤:
1、设置yum库
起首,须要在体系上启用Remi和EPEL yum存储库。运用以下敕令在CentOS体系上装置EPEL存储库
运用此敕令装置epel-release yum存储库
# yum install epel-release
如今依据你的操作体系版本实行以下敕令之一来装置Remi 存储库。
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
2、在CentOS 6上装置PHP 7
你的体系已为从yum存储库装置PHP做好了预备。依据须要,运用以下敕令之一在体系上装置PHP 7.3或PHP 7.2或PHP 7.1。
## 装置PHP 7.3 $ yum --enablerepo=remi-php73 install php ## 装置PHP 7.2 $ yum --enablerepo=remi-php72 install php ## 装置PHP 7.1 $ yum --enablerepo=remi-php71 install php
我已在我的体系上装置了最新版本的PHP 7.3。如今运转以下敕令来搜检体系的当前运用的PHP版本。
$ php -v PHP 7.3.0 (cli) (built: Dec 4 2018 16:12:20) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
装置PHP模块
你还能够须要依据你的应用程序需求装置分外的PHP模块。
下面的敕令将装置一些有效的PHP模块。
### For PHP 7.3 $ yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.2 $ yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.1 $ yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
你能够运转以下敕令,在已设置的yum存储库下搜刮其他可用的PHP模块。
下面的示例敕令搜刮PHP 7.3的一切模块。
$ yum --enablerepo=remi-php73 search php | grep php73 php73.x86_64 : Package that installs PHP 7.3 php73-php.x86_64 : PHP scripting language for creating dynamic web sites php73-php-bcmath.x86_64 : A module for PHP applications for using the bcmath php73-php-brotli.x86_64 : Brotli Extension for PHP php73-php-cli.x86_64 : Command-line interface for PHP php73-php-common.x86_64 : Common files for PHP ... ...
更多PHP相干学问,请接见ki4网!
以上就是CentOS怎样装置php?的细致内容,更多请关注ki4网别的相干文章!