Laravel のインストール
公開日:2020-02-02
更新日:2020-07-21
更新日:2020-07-21
1. 概要
PHP用Webアプリフレームワークである Laravel のインストールします。
2. Laravel のインストール
事前準備
yum install zip unzip
yum install --enablerepo=remi-php74 php-zip
yum install --enablerepo=remi-php74 php-dom
以下の警告やエラーが出る場合は、上記のインストールを行ってください。
As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
Problem 1
- laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].
Problem 1
- Installation request for tijsverkoyen/css-to-inline-styles 2.2.2 -> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.2].
- tijsverkoyen/css-to-inline-styles 2.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Laravelインストーラーの作成
cd /var/www/html
mkdir laravel
cd laravel
composer require laravel/installer
Laravelプロジェクトの作成
cd /var/www/html
/var/www/html/laravel/vendor/bin/laravel new laravel_test
http://192.168.233.100/laravel_test/public/ にアクセスして、
以下のエラーが表示されれば OK です。
UnexpectedValueException
The stream or file "/var/www/html/laravel_test/storage/logs/laravel.log" could not be opened:
failed to open stream: Permission denied
これはログ出力の権限が不足しているためです。
プロジェクト全体を apache ユーザに変更します。
chown apache:apache /var/www/html/laravel_test -R
http://192.168.233.100/laravel_test/public/ にアクセスして、
「Laravel」と書かれは画面が表示されれば OK です。
まだエラーが出る場合は、SELinux の設定を確認してください。
確認
ls -alZ
設定
chcon -R -t httpd_sys_rw_content_t /var/www/html/laravel_test

