PHP
laravel

Amazon EC2 (RHEL 7.5 AMI)に PHP 7.2 + Laravel 5.5 + MySQL 5.7 をインストールする手順 (201805版)

参考資料

Goal

Amazon EC2 (RHEL 7.5)に PHP 7 + Laravel 5.5 + Apache 2.4 + MySQL をインストールする

手順

PHP 7.2

#    Turn on EPEL repo, enter:
sudo yum -y install epel-release
#   Turn on Remi repo i.e.remi-php72:
sudo yum-config-manager --enable remi-php72
#   Refresh repository:
sudo yum update
#   Install php version 7.2, run:
sudo yum install php

Git

sudo yum install git

Composer

sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chown root:root /usr/local/bin/composer
ll /usr/local/bin/composer

※Macの場合は sudo chown root:wheel /usr/local/bin/composer

MySQL

yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
sudo yum info mysql-community-server
sudo yum -y install mysql-community-server
mysqld --version
# Start MYSQL
sudo systemctl enable mysqld.service
#sudo service mysqld start
sudo systemctl start mysqld.service

grep "A temporary password is generated" /var/log/mysqld.log
sudo mysql_secure_installation
CREATE USER your_user IDENTIFIED BY 'your_password';

drop database your_database;
create database your_database character set utf8;
show create database your_database;
GRANT ALL PRIVILEGES ON your_database.* TO your_user@localhost IDENTIFIED BY 'your_password';
flush privileges;

select Host, User, Password  from mysql.user;

mysql -u your_user -p

RDS利用の場合、上記MySQLインストールは不要

mysql -haaaaaaaa-db.bbbbbb.ap-northeast-1.rds.amazonaws.com -uuseraaaa -p

PHP - MySQL Library install

sudo yum list available | grep php72
sudo yum install -y php-mysqlnd
sudo yum install -y php-mbstring php-xml
sudo yum list installed | grep php