您好,欢迎访问一九零五行业门户网

CentOS如何安装php?

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 -vphp 7.3.0 (cli) (built: dec 4 2018 16:12:20) ( nts )copyright (c) 1997-2018 the php groupzend 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 php73php73.x86_64 : package that installs php 7.3php73-php.x86_64 : php scripting language for creating dynamic web sitesphp73-php-bcmath.x86_64 : a module for php applications for using the bcmathphp73-php-brotli.x86_64 : brotli extension for phpphp73-php-cli.x86_64 : command-line interface for phpphp73-php-common.x86_64 : common files for php......
更多php相关知识,请访问!
以上就是centos如何安装php?的详细内容。
其它类似信息

推荐信息