LoginSignup
0
0

More than 1 year has passed since last update.

Amazon Linux 2 で PHP7.4 から 8.1 にアップグレードする方法

Last updated at Posted at 2023-02-01

以前書いた記事の PHP 7.4 -> PHP 8.1 バージョンアップ版です。(Amazon Linux Extra を使用する前提)

以前の記事 -> Amazon Linux 2 で Nginx, MariaDB, PHP7.2 から 7.4 にアップグレードする方法

ISO 127001 認証を取得しているセキュアかつ簡単な操作が可能で開発もしやすい Concrete CMS をインストールしているサーバーで

  • PHP7.4.x -> PHP8.1.x

にアップデートした時のコマンドメモです。

めっちゃくちゃざっくりです。

アップグレード元のバージョンが違ったり、レポジトリが違ったりあって、
いろんなケースの手順をまとめてます。

PHP+MySQL のサーバーに詳しい人しか参考にしないでください。

旧バージョンの Amazon Linux Extra のレポジトリを Disable

sudo amazon-linux-extras disable php7.4

新バージョンのレポジトリを enable

sudo amazon-linux-extras enable php8.1

単純に yum update でアップデート。カーネルのアップデートとかもあるし

多分、カーネルとかいろいろアップデートあると思うので、ついでにしましょう。サーバー再起動が必要になります。

sudo yum update

サーバー再起動がNGであれば、PHP だけ。

sudo yum update php*

スタートアップ起動しているか確認

注意) Nginx + php-fpm 想定

sudo systemctl is-enabled php-fpm
sudo systemctl is-enabled nginx

Disable だったら、enable (サーバー再起動時に起動するように)。

sudo systemctl enable php-fpm
sudo systemctl enable nginx

(Nginx サーバーだったら) PHP キャッシュ・セッション系のオーナーが apache に変わるので Nginx に戻す

sudo chown -R nginx:nginx /var/lib/php

再起動

サーバー再起動であれば

sudo reboot

PHP プロセスの再起動だけであれば

sudo systemctl restart php-fpm

多分、これでOK

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0