2
6

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.

CentOS7 php + Composerインストール

Last updated at Posted at 2020-03-30

PHP + Composerインストールメモ

環境用意する際によく忘れてしまうので覚書

GCP Centosインスタンス

GCPデフォルトインスタンスシリーズで CentOSインスタンスを作成するとSELinuxはOnの状態になっているので無効化

# vi /etc/selinux/config

SELINUX=enforcing
↓↓↓↓
SELINUX=disabled

# reboot

phpインストール

# yum update -y

# yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

# yum -y install --enablerepo=remi,remi-php73 php php-mbstring php-xml php-xmlrpc php-gd php-pdo php-pecl-mcrypt php-mysqlnd php-pecl-mysql

# php -v
PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies

AWS Amazon Linuxの場合

  • Amazon Linuxが持っているリポジトリにはバージョン5.4のPHPのみなので、remiリポジトリを使えるようにする必要がある
amazon-linux-extras install epel
yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Composerインストール

# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

# php composer-setup.php

All settings correct for using Composer
Downloading...

Composer (version 1.10.1) successfully installed to: /var/www/html/ga/composer.phar
Use it: php composer.phar

#rm composer-setup.php
rm: remove regular file ‘composer-setup.php’? y

# mv composer.phar /usr/local/bin/composer

# composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.10.1 2020-03-13 20:34:27
2
6
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
2
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?