CentOs8 php7.4をインストールする
centos上で動いてるphpのバージョンを上げたかったので、php7.4にアップデートした際の手順を記載。
環境
- OS CentOS Linux release 8.0.1905 (Core)
EPELとREMIリポジトリ追加
下記のコマンドでリポジトリを追加します。
## epel
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
## remi
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
PHP7.4インストール
php7.4をインストールします。
## 先にutilsをインストールします
sudo dnf -y install dnf-utils
## 7.4をインストールします。
sudo dnf module install php:remi-7.4
すでに7.3が入っているため、エラーが発生しました。
The operation would result in switching of module 'php' stream 'remi-7.3' to stream 'remi-7.4'
エラー: It is not possible to switch enabled streams of a module.
It is recommended to remove all installed content from the module, and reset the module using 'dnf module reset <module_name>' command. After you reset the module, you can install the other stream.
下記のコマンドでリセットします。
sudo dnf module reset php
再度インストールします。
sudo dnf module install php:remi-7.4
バージョンを確認します。
php -v
<出力結果>
PHP 7.4.3 (cli) (built: Feb 18 2020 11:53:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
-
前の記事
React.js ライブラリ「react-toastify」を使用してアラート機能を実装する 2020.03.12
-
次の記事
Nuxt.js vue-social-shareを使用してSNSボタンを実装する 2020.03.13
コメントを書く