您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何在CentOS和RHEL上安装PHP7

2025/3/13 2:12:41发布31次查看
php7.3是php的最新稳定版本,yum存储库正在为php7提供rpm包。本篇文章将使用remi和epel-yum存储库在你的系统上安装所需的软件包,将介绍在centos和redhat7服务器上安装php 7.3、php 7.2、php 7.1。
设置yum存储库
首先,需要在系统上启用remi和epel yum存储库。使用以下命令在centos和red hat 7/6系统上安装epel存储库
使用此命令在系统上安装epel yum存储库
$ sudo yum install epel-release
现在根据你的操作系统版本执行以下命令之一以安装remi存储库。
$ sudo rpm -uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
在centos上安装php 7
你的系统已准备好从yum存储库安装php。根据你的需求,使用以下命令之一在系统上安装php 7.3、php 7.2或php 7.1。
## install php 7.3 $ yum --enablerepo=remi-php73 install php## install php 7.2 $ yum --enablerepo=remi-php72 install php## install 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 phpphp73-php-componere.x86_64 : composing php classes at runtimephp73-php-dba.x86_64 : a database abstraction layer module for php applicationsphp73-php-dbg.x86_64 : the interactive php debuggerphp73-php-devel.x86_64 : files needed for building php extensionsphp73-php-embedded.x86_64 : php library for embedding in applicationsphp73-php-enchant.x86_64 : enchant spelling extension for php applicationsphp73-php-fpm.x86_64 : php fastcgi process managerphp73-php-gd.x86_64 : a module for php applications for using the gd graphics......
本篇文章到这里就已经全部结束了,更多其他精彩内容大家可以关注的php视频教程栏目!!!
以上就是如何在centos和rhel上安装php7的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product