- 1. 概要
- 2. プロジェクト作成
- 3. 所有権の設定
1. 概要
前回、前々回と、実は無駄な作業が多かったのだ。
今回、参考サイトがどこだったか忘れちゃいましたが、もっと簡単な手順で、無駄の内容にやってみます。
2. インストール
前は、「Laravel」をインストールするところからやったいましたが、そんなもの必要ない。
「composer」をインストールしていれば、いきなり、プロジェクトの作成からいけます。
プロジェクト名を「laravel」としておきます。
プロジェクトを作成するパスへ移動して、ログインユーザで。
「laravel」のプロジェクトを作成。
composer create-project laravel/laravel laravel --prefer-dist
下記のようなログが出力されます。
Creating a "laravel/laravel" project at "./laravel"
Installing laravel/laravel (v10.3.1)
- Installing laravel/laravel (v10.3.1): Extracting archive
Created project in /usr/local/www/laravel
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 111 installs, 0 updates, 0 removals
- Locking brick/math (0.11.0)
- Locking carbonphp/carbon-doctrine-types (2.1.0)
- Locking dflydev/dot-access-data (v3.0.2)
・・・ 略 ・・・
- Locking vlucas/phpdotenv (v5.6.0)
- Locking voku/portable-ascii (2.0.1)
- Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 111 installs, 0 updates, 0 removals
- Installing doctrine/inflector (2.0.8): Extracting archive
- Installing doctrine/lexer (3.0.0): Extracting archive
- Installing symfony/polyfill-ctype (v1.28.0): Extracting archive
・・・ 略 ・・・
- Installing spatie/flare-client-php (1.4.3): Extracting archive
- Installing spatie/ignition (1.12.0): Extracting archive
- Installing spatie/laravel-ignition (2.4.0): Extracting archive
52 package suggestions were added by new dependencies, use 'composer suggest' to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
laravel/sail ............................................................................................. DONE
laravel/sanctum .......................................................................................... DONE
laravel/tinker ........................................................................................... DONE
nesbot/carbon ............................................................................................ DONE
nunomaduro/collision ..................................................................................... DONE
nunomaduro/termwind ...................................................................................... DONE
spatie/laravel-ignition .................................................................................. DONE
83 packages you are using are looking for funding.
Use the 'composer fund' command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
INFO No publishable resources for tag [laravel-assets].
No security vulnerability advisories found.
> @php artisan key:generate --ansi
INFO Application key set successfully.
プロジェクトのディレクトリへ移動して「phpmailer」を追加。
cd laravel
composer require phpmailer/phpmailer
下記のようなログが出力されます。
./composer.json has been updated
Running composer update phpmailer/phpmailer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking phpmailer/phpmailer (v6.9.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing phpmailer/phpmailer (v6.9.1): Extracting archive
5 package suggestions were added by new dependencies, use 'composer suggest' to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
laravel/sail ............................................................................................. DONE
laravel/sanctum .......................................................................................... DONE
laravel/tinker ........................................................................................... DONE
nesbot/carbon ............................................................................................ DONE
nunomaduro/collision ..................................................................................... DONE
nunomaduro/termwind ...................................................................................... DONE
spatie/laravel-ignition .................................................................................. DONE
84 packages you are using are looking for funding.
Use the 'composer fund' command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
INFO No publishable resources for tag [laravel-assets].
No security vulnerability advisories found.
Using version ^6.9 for phpmailer/phpmailer
3. 所有権の設定
「Laravel」を動作させる上で、ログやキャッシュのフォルダは、「www」の所有権にしておかないと権限エラーになるものがあります。
「root」ユーザ権限で、下記の設定を行います。
今回、プロジェクトパスを
/usr/local/www/laravel
にしていますので
chown -R www:www /usr/local/www/laravel/bootstrap/cache
chown -R www:www /usr/local/www/laravel/storage/framework
chown -R www:www /usr/local/www/laravel/storage/logs
|