PHP
PHP5からPHP7.2にアップデート
AmazonLinuxには、PHP7.3のパッケージにはpecl-xxxが存在せず、PHP7.4はパッケージすら存在しなかったので
PHP7.2をインストールする。
sudo yum -y install php72 php72-cli php72-common php72-devel php72-mysqlnd php72-pdo php72-xml php72-gd php72-intl php72-mbstring php72-mcrypt php72-opcache php72-pecl-apcu php72-pecl-imagick php72-pecl-memcached php72-pecl-redis php72-pecl-xdebug
使用するPHPを7.2に設定
sudo alternatives --set php /usr/bin/php-7.2
Swapファイル
標準だとLaravelプロジェクト作成時に
The following exception is caused by a lack of memory or swap, or not having swap configured
とメモリ不足でエラーが出ることがあるので、以下のコマンドでSwapファイルを作成しておく。
Swapファイルを作成
sudo /bin/dd if=/dev/zero of=/swap bs=1M count=1024
sudo chmod 600 /swap
sudo mkswap /swap
sudo swapon /swap
Compser
Composerをダウンロード
curl -sS https://getcomposer.org/installer | php
Composerを/usr/local/binに移動
sudo mv composer.phar /usr/local/bin/composer
Composerが動作することを確認
composer
Laravel
Composerを使ってLaravelをインストール
composer global require "laravel/installer"
Laravelプロジェクトを作成する
composer create-project laravel/laravel [プロジェクト名]
Laravelのバージョン確認
php artisan --version
Laravel起動
php artisan serve --port=8080
動作確認
Preview->Preview Running Application