close

PHP is an open-source programming language widely for web development, created by Rasmus Lerdorf. It is an HTML-embedded scripting language for creating dynamic web sites.

In this post, we will see how to install PHP 7.4 / 7.3 on CentOS 8 / RHEL 8. Add Remi Repository

Remi, a third-party repository which offers multiple versions of PHP (7.4 / 7.3 / 7.2) for Red Hat Enterprise Linux.

Remi repository requires EPEL repository be enabled on your system.

 

環境準備安裝最新EPEL庫 
參考[CentOS 8] 無法使用: No URLs in mirrorlist error

 


 

       sudo dnf module list php

sudo dnf module reset php

sudo dnf module enable php:remi-7.4

2023-01-07_142353.png

 

sudo dnf install php php-opcache php-gd php-curl php-mysqlnd

2023-01-07_142437.png

2023-01-07_142532.png

php -v

2023-01-07_142551.png

sudo systemctl enable php-fpm

2023-01-07_142608.png

sudo systemctl start php-fpm

sudo systemctl status php-fpm

2023-01-07_142655.png

sudo yum install -y php php-xml php-session php-sockets php-ldap php-gd php-json php-mysqlnd php-gmp php-mbstring php-posix php-snmp php-intl

2023-01-07_142750.png

sudo vim /var/www/html/info.php

新增以下資訊

<?php phpinfo( ); ?>

打開瀏覽器輸入 http://localhost/info.php 確認運作正常

2023-01-07_143638.png

 

參考文章:

How to Install PHP 7.4 on CentOS 8 (tecmint.com)
How To Install PHP 7.4 on CentOS 8 / RHEL 8 | ComputingForGeeks

CentOS 8 yum/dnf 安裝 PHP 指定或最新版本 - 腳印網頁資訊設計 (footmark.com.tw)
How to Install PHP on CentOS 8 | Linuxize


arrow
arrow

    sungshu 發表在 痞客邦 留言(0) 人氣()