14
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

yumでphp8をインストールしよう!!!

Posted at

概要

php8.0をamazon linux 2を使っインストールする。

awsのcloud9を利用して開発する。

前提

cloud9の設定

  • Create a new EC2 instance for environment (direct access)
  • t2.micro (1 GiB RAM + 1 vCPU)
  • Amazon Linux 2 (recommended)
  • After 30 minutes (default)

内容

phpもともと入ってました。

Linux
$ php -v
PHP 7.2.24
$ amazon-linux-extras list php

PHP 8.*は存在しませんでした。

Linux
$ sudo amazon-linux-extras install epel
$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

epelとremiを使ってphp8系をインストールします

Linux
$ sudo yum -y install php80 php80-php php80-php-mbstring php80-php-pdo php80-php-xml php80-php-fpm php80-php-mysqlnd php80-php-gd
Linux
$ php80 -v
PHP 8.0.0 (cli)
やったね〜

でも....まだphpのversionは7.2です

##php72の削除

Linux
$ sudo yum remove php-*
$ php -v
bash: /usr/bin/php: No such file or directory

##php80をphpとして設定する

Linux
$ sudo alternatives --install /usr/bin/php php /usr/bin/php80 1

##php8、最高w

Linux
$ php -v
PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies

関連記事

#最後に
初投稿でした。

14
10
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
14
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?