- 1. 概要
- 2. プロジェクト作成
- 3. 所有権の設定
1. 概要
インストールします。
2. プロジェクト作成
今回は、バージョン指定なし。
2025年3月27日時点で最新のものをインストールします。
プロジェクト名を「laravel」としておきます。
プロジェクトを作成するパスへ移動して、ログインユーザで。
composer create-project laravel/laravel laravel
下記のようなログが出力されます。
Creating a "laravel/laravel" project at "./laravel"
Installing laravel/laravel (v12.0.3)
- Installing laravel/laravel (v12.0.3): 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: 110 installs, 0 updates, 0 removals
- Locking brick/math (0.12.3)
- Locking carbonphp/carbon-doctrine-types (3.2.0)
- Locking dflydev/dot-access-data (v3.0.3)
・・・ 略 ・・・
- Installing phar-io/manifest (2.0.4): Extracting archive
- Installing myclabs/deep-copy (1.13.0): Extracting archive
- Installing phpunit/phpunit (11.5.15): Extracting archive
53 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/pail ............................................................................................. DONE
laravel/sail ............................................................................................. DONE
laravel/tinker ........................................................................................... DONE
nesbot/carbon ............................................................................................ DONE
nunomaduro/collision ..................................................................................... DONE
nunomaduro/termwind ...................................................................................... DONE
80 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.
> @php -r "file_exists('database/database.sqlite') || touch('database/database.sqlite');"
> @php artisan migrate --graceful --ansi
INFO Preparing database.
Creating migration table ........................................................................ 237.83ms DONE
INFO Running migrations.
0001_01_01_000000_create_users_table ............................................................ 315.26ms DONE
0001_01_01_000001_create_cache_table ............................................................ 114.49ms DONE
0001_01_01_000002_create_jobs_table ............................................................. 280.26ms DONE
1分もかからずに、終わりました。
プロジェクトのディレクトリへ移動して「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.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Downloading phpmailer/phpmailer (v6.9.3)
- Installing phpmailer/phpmailer (v6.9.3): 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/pail ............................................................................................. DONE
laravel/sail ............................................................................................. DONE
laravel/tinker ........................................................................................... DONE
nesbot/carbon ............................................................................................ DONE
nunomaduro/collision ..................................................................................... DONE
nunomaduro/termwind ...................................................................................... DONE
81 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
にしていますので。
「root」ユーザ権限で。
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
chown -R www:www /usr/local/www/laravel/database
上記、今までより、ひとつ多くなっています。
「Laravel Framework 12.*」では、「sqlite3」のデータベースを使用しているようなのです。
|