GNU/Linux >> Tutoriales Linux >  >> Cent OS

Cómo instalar PHP 8 en CentOS 8 Linux

Este tutorial explicará cómo instalar PHP 8 en CentOS 8 Linux y sus paquetes dependientes.

Paso 1:habilitar remi-release-8.rpm

Configure el repositorio de Remi para instalar PHP 8 en CentOS 8

# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Paso 2:Habilitar el repositorio EPEL

# dnf install epel-release

Paso 3:Encuentre la versión habilitada actual de PHP

# dnf module list php
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Paso 4:Habilitar el módulo PHP8.1 de remi

De la salida anterior, por defecto PHP 7.2 desde el AppStream se instalará el repositorio y no se habilitará ninguna otra versión. Para instalar PHP 8.1 del remi repo, habilítelo antes de la instalación.

# dnf module enable php:remi-8.1
# dnf module list php
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 [e] common [d], devel, minimal PHP scripting language
¿Cambiar a la otra versión?

En caso de que necesite instalar cualquier otra versión, puede restablecer el módulo actual habilitado y configurar el nuevo usando los siguientes comandos:

# dnf module reset php

# dnf module enable php:remi-8.0

Paso 5:Instale PHP 8 en CentOS 8

# dnf install php

Last metadata expiration check: 0:13:44 ago on Wed 16 Feb 2022 11:53:53 AM IST.
Dependencies resolved.
=============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
php x86_64 8.1.2-1.el8.remi remi-modular 1.7 M
Installing dependencies:
apr x86_64 1.6.3-12.el8 appstream 129 k
apr-util x86_64 1.6.1-6.el8 appstream 105 k
centos-logos-httpd noarch 85.8-2.el8 baseos 75 k
httpd x86_64 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 1.4 M
httpd-filesystem noarch 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 39 k
httpd-tools x86_64 2.4.37-43.module_el8.5.0+1022+b541f3b1 appstream 107 k
libsodium x86_64 1.0.18-2.el8 epel 162 k
libxslt x86_64 1.1.32-6.el8 baseos 250 k
mailcap noarch 2.1.48-3.el8 baseos 39 k
mod_http2 x86_64 1.15.7-3.module_el8.4.0+778+c970deab appstream 154 k
oniguruma5php x86_64 6.9.7.1-1.el8.remi remi-safe 210 k
php-common x86_64 8.1.2-1.el8.remi remi-modular 1.2 M
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 appstream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 appstream 27 k
nginx-filesystem noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 appstream 24 k
php-cli x86_64 8.1.2-1.el8.remi remi-modular 5.3 M
php-fpm x86_64 8.1.2-1.el8.remi remi-modular 1.8 M
php-mbstring x86_64 8.1.2-1.el8.remi remi-modular 522 k
php-opcache x86_64 8.1.2-1.el8.remi remi-modular 628 k
php-pdo x86_64 8.1.2-1.el8.remi remi-modular 160 k
php-sodium x86_64 8.1.2-1.el8.remi remi-modular 100 k
php-xml x86_64 8.1.2-1.el8.remi remi-modular 250 k
Enabling module streams:
httpd 2.4
nginx 1.14

Transaction Summary
=============================================================================================================================================================================================================================================
Install 23 Packages

Paso 6:Verificar la instalación de PHP

# php -v
PHP 8.1.2 (cli) (built: Jan 18 2022 23:52:03) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

¡Eso es todo! Disfruta de la codificación PHP 🙂


Cent OS
  1. Cómo instalar PHP 5.5 en CentOS

  2. Cómo instalar PHP 5.6 en CentOS 7

  3. Cómo instalar PHP 8 en CentOS 7

  4. Cómo instalar PHP 8 en CentOS 8

  5. Cómo instalar PHP 7.3 en CentOS 7

Cómo instalar VirtualBox en CentOS 8 Linux

Cómo instalar Skype en CentOS 8 Linux

Cómo instalar Drupal en CentOS 7

Cómo instalar PHP en CentOS 8

Cómo instalar PHP 7.4 en CentOS 8 / RHEL 8

Cómo instalar PHP 7 en CentOS 7