WindowsでLaravel

PHP、Composer、Apacheのインストールと設定はコチラを参照

Laravelのプロジェクトを作成

composerで作成してみる

> composer create-project laravel/laravel test-laravel
Creating a "laravel/laravel" project at "./test-laravel"

In Factory.php line 654:

  The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl ext
  ension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package> [<directory> [<version>]]]

真っ赤か。
php.iniの設定でOpenSSLの拡張を有効にせよとのことなので実施

# PHPインストールフォルダに移動
> cd .\scoop\apps\php\current\

# 開発用設定をコピーして php.ini を作成
> cp .\php.ini-development php.ini

# php.ini を編集
> vi php.ini

下記の行のコメントアウトを外す
extension_dir = "ext"
extension=openssl

再度、composer実行

> composer create-project laravel/laravel test-laravel
Creating a "laravel/laravel" project at "./test-laravel"
Installing laravel/laravel (v11.1.4)
  - Downloading laravel/laravel (v11.1.4)
  - Installing laravel/laravel (v11.1.4): Extracting archive
Created project in C:\Users\tmacoto\Work\test-laravel
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v11.9.0, ..., v11.20.0] require league/flysystem ^3.8.0 -> satisfiable by league/flysystem[3.8.0, ..., 3.28.0].
    - league/flysystem[3.3.0, ..., 3.14.0] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.15.0].
    - league/flysystem[3.15.0, ..., 3.28.0] require league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.15.0, ..., 3.28.0].
    - league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.3.10) does not satisfy that requirement.
    - league/mime-type-detection[1.4.0, ..., 1.15.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - league/flysystem-local[3.15.0, ..., 3.28.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - Root composer.json requires laravel/framework ^11.9 -> satisfiable by laravel/framework[v11.9.0, ..., v11.20.0].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\Users\tmacoto\scoop\apps\php\current\php.ini
    - C:\Users\tmacoto\scoop\apps\php\current\cli\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.

まだエラーが出てくる
php.iniを再度調整する

> vi php.ini

下記の行のコメントアウトを外す
extension=fileinfo

再々度、composer実行

> composer create-project laravel/laravel test-laravel
Creating a "laravel/laravel" project at "./test-laravel"
Installing laravel/laravel (v11.1.4)
  - Installing laravel/laravel (v11.1.4): Extracting archive
Created project in C:\Users\tmacoto\Work\test-laravel
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 107 installs, 0 updates, 0 removals
  - Locking brick/math (0.12.1)
  - Locking carbonphp/carbon-doctrine-types (3.2.0)
  - Locking dflydev/dot-access-data (v3.0.3)
  - Locking doctrine/inflector (2.0.10)
  - Locking doctrine/lexer (3.0.1)
  - Locking dragonmantank/cron-expression (v3.3.3)
  - Locking egulias/email-validator (4.0.2)
  - Locking fakerphp/faker (v1.23.1)
  - Locking filp/whoops (2.15.4)
  - Locking fruitcake/php-cors (v1.3.0)
  - Locking graham-campbell/result-type (v1.1.3)
  - Locking guzzlehttp/guzzle (7.9.2)
  - Locking guzzlehttp/promises (2.0.3)
  - Locking guzzlehttp/psr7 (2.7.0)
  - Locking guzzlehttp/uri-template (v1.0.3)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v11.20.0)
  - Locking laravel/pint (v1.17.2)
  - Locking laravel/prompts (v0.1.24)
  - Locking laravel/sail (v1.31.1)
  - Locking laravel/serializable-closure (v1.3.4)
  - Locking laravel/tinker (v2.9.0)
  - Locking league/commonmark (2.5.3)
  - Locking league/config (v1.2.0)
  - Locking league/flysystem (3.28.0)
  - Locking league/flysystem-local (3.28.0)
  - Locking league/mime-type-detection (1.15.0)
  - Locking mockery/mockery (1.6.12)
  - Locking monolog/monolog (3.7.0)
  - Locking myclabs/deep-copy (1.12.0)
  - Locking nesbot/carbon (3.7.0)
  - Locking nette/schema (v1.3.0)
  - Locking nette/utils (v4.0.5)
  - Locking nikic/php-parser (v5.1.0)
  - Locking nunomaduro/collision (v8.4.0)
  - Locking nunomaduro/termwind (v2.0.1)
  - Locking phar-io/manifest (2.0.4)
  - Locking phar-io/version (3.2.1)
  - Locking phpoption/phpoption (1.9.3)
  - Locking phpunit/php-code-coverage (11.0.5)
  - Locking phpunit/php-file-iterator (5.0.1)
  - Locking phpunit/php-invoker (5.0.1)
  - Locking phpunit/php-text-template (4.0.1)
  - Locking phpunit/php-timer (7.0.1)
  - Locking phpunit/phpunit (11.3.1)
  - Locking psr/clock (1.0.0)
  - Locking psr/container (2.0.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.3)
  - Locking psr/http-factory (1.1.0)
  - Locking psr/http-message (2.0)
  - Locking psr/log (3.0.0)
  - Locking psr/simple-cache (3.0.0)
  - Locking psy/psysh (v0.12.4)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (2.0.0)
  - Locking ramsey/uuid (4.7.6)
  - Locking sebastian/cli-parser (3.0.2)
  - Locking sebastian/code-unit (3.0.1)
  - Locking sebastian/code-unit-reverse-lookup (4.0.1)
  - Locking sebastian/comparator (6.0.2)
  - Locking sebastian/complexity (4.0.1)
  - Locking sebastian/diff (6.0.2)
  - Locking sebastian/environment (7.2.0)
  - Locking sebastian/exporter (6.1.3)
  - Locking sebastian/global-state (7.0.2)
  - Locking sebastian/lines-of-code (3.0.1)
  - Locking sebastian/object-enumerator (6.0.1)
  - Locking sebastian/object-reflector (4.0.1)
  - Locking sebastian/recursion-context (6.0.2)
  - Locking sebastian/type (5.0.1)
  - Locking sebastian/version (5.0.1)
  - Locking symfony/clock (v7.1.1)
  - Locking symfony/console (v7.1.3)
  - Locking symfony/css-selector (v7.1.1)
  - Locking symfony/deprecation-contracts (v3.5.0)
  - Locking symfony/error-handler (v7.1.3)
  - Locking symfony/event-dispatcher (v7.1.1)
  - Locking symfony/event-dispatcher-contracts (v3.5.0)
  - Locking symfony/finder (v7.1.3)
  - Locking symfony/http-foundation (v7.1.3)
  - Locking symfony/http-kernel (v7.1.3)
  - Locking symfony/mailer (v7.1.2)
  - Locking symfony/mime (v7.1.2)
  - Locking symfony/polyfill-ctype (v1.30.0)
  - Locking symfony/polyfill-intl-grapheme (v1.30.0)
  - Locking symfony/polyfill-intl-idn (v1.30.0)
  - Locking symfony/polyfill-intl-normalizer (v1.30.0)
  - Locking symfony/polyfill-mbstring (v1.30.0)
  - Locking symfony/polyfill-php72 (v1.30.0)
  - Locking symfony/polyfill-php80 (v1.30.0)
  - Locking symfony/polyfill-php83 (v1.30.0)
  - Locking symfony/polyfill-uuid (v1.30.0)
  - Locking symfony/process (v7.1.3)
  - Locking symfony/routing (v7.1.3)
  - Locking symfony/service-contracts (v3.5.0)
  - Locking symfony/string (v7.1.3)
  - Locking symfony/translation (v7.1.3)
  - Locking symfony/translation-contracts (v3.5.0)
  - Locking symfony/uid (v7.1.1)
  - Locking symfony/var-dumper (v7.1.3)
  - Locking symfony/yaml (v7.1.1)
  - Locking theseer/tokenizer (1.2.3)
  - Locking tijsverkoyen/css-to-inline-styles (v2.2.7)
  - Locking vlucas/phpdotenv (v5.6.1)
  - 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: 107 installs, 0 updates, 0 removals
  - Downloading doctrine/inflector (2.0.10)
  - Downloading doctrine/lexer (3.0.1)
  - Downloading symfony/polyfill-ctype (v1.30.0)
  - Downloading webmozart/assert (1.11.0)
  - Downloading dragonmantank/cron-expression (v3.3.3)
  - Downloading symfony/deprecation-contracts (v3.5.0)
  - Downloading psr/container (2.0.2)
  - Downloading fakerphp/faker (v1.23.1)
  - Downloading symfony/polyfill-php83 (v1.30.0)
  - Downloading symfony/polyfill-mbstring (v1.30.0)
  - Downloading symfony/http-foundation (v7.1.3)
  - Downloading fruitcake/php-cors (v1.3.0)
  - Downloading psr/http-message (2.0)
  - Downloading psr/http-client (1.0.3)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading psr/http-factory (1.1.0)
  - Downloading guzzlehttp/psr7 (2.7.0)
  - Downloading guzzlehttp/promises (2.0.3)
  - Downloading guzzlehttp/guzzle (7.9.2)
  - Downloading symfony/polyfill-php80 (v1.30.0)
  - Downloading guzzlehttp/uri-template (v1.0.3)
  - Downloading laravel/pint (v1.17.2)
  - Downloading symfony/polyfill-intl-normalizer (v1.30.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.30.0)
  - Downloading symfony/string (v7.1.3)
  - Downloading symfony/service-contracts (v3.5.0)
  - Downloading symfony/console (v7.1.3)
  - Downloading voku/portable-ascii (2.0.1)
  - Downloading phpoption/phpoption (1.9.3)
  - Downloading graham-campbell/result-type (v1.1.3)
  - Downloading vlucas/phpdotenv (v5.6.1)
  - Downloading symfony/css-selector (v7.1.1)
  - Downloading tijsverkoyen/css-to-inline-styles (v2.2.7)
  - Downloading symfony/var-dumper (v7.1.3)
  - Downloading symfony/polyfill-uuid (v1.30.0)
  - Downloading symfony/uid (v7.1.1)
  - Downloading symfony/routing (v7.1.3)
  - Downloading symfony/process (v7.1.3)
  - Downloading symfony/polyfill-php72 (v1.30.0)
  - Downloading symfony/polyfill-intl-idn (v1.30.0)
  - Downloading symfony/mime (v7.1.2)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v3.5.0)
  - Downloading symfony/event-dispatcher (v7.1.1)
  - Downloading psr/log (3.0.0)
  - Downloading egulias/email-validator (4.0.2)
  - Downloading symfony/mailer (v7.1.2)
  - Downloading symfony/error-handler (v7.1.3)
  - Downloading symfony/http-kernel (v7.1.3)
  - Downloading symfony/finder (v7.1.3)
  - Downloading ramsey/collection (2.0.0)
  - Downloading brick/math (0.12.1)
  - Downloading ramsey/uuid (4.7.6)
  - Downloading psr/simple-cache (3.0.0)
  - Downloading nunomaduro/termwind (v2.0.1)
  - Downloading symfony/translation-contracts (v3.5.0)
  - Downloading symfony/translation (v7.1.3)
  - Downloading psr/clock (1.0.0)
  - Downloading symfony/clock (v7.1.1)
  - Downloading carbonphp/carbon-doctrine-types (3.2.0)
  - Downloading nesbot/carbon (3.7.0)
  - Downloading monolog/monolog (3.7.0)
  - Downloading league/mime-type-detection (1.15.0)
  - Downloading league/flysystem (3.28.0)
  - Downloading league/flysystem-local (3.28.0)
  - Downloading nette/utils (v4.0.5)
  - Downloading nette/schema (v1.3.0)
  - Downloading dflydev/dot-access-data (v3.0.3)
  - Downloading league/config (v1.2.0)
  - Downloading league/commonmark (2.5.3)
  - Downloading laravel/serializable-closure (v1.3.4)
  - Downloading laravel/prompts (v0.1.24)
  - Downloading laravel/framework (v11.20.0)
  - Downloading symfony/yaml (v7.1.1)
  - Downloading laravel/sail (v1.31.1)
  - Downloading nikic/php-parser (v5.1.0)
  - Downloading psy/psysh (v0.12.4)
  - Downloading laravel/tinker (v2.9.0)
  - Downloading hamcrest/hamcrest-php (v2.0.1)
  - Downloading mockery/mockery (1.6.12)
  - Downloading filp/whoops (2.15.4)
  - Downloading nunomaduro/collision (v8.4.0)
  - Downloading sebastian/version (5.0.1)
  - Downloading sebastian/type (5.0.1)
  - Downloading sebastian/recursion-context (6.0.2)
  - Downloading sebastian/object-reflector (4.0.1)
  - Downloading sebastian/object-enumerator (6.0.1)
  - Downloading sebastian/global-state (7.0.2)
  - Downloading sebastian/exporter (6.1.3)
  - Downloading sebastian/environment (7.2.0)
  - Downloading sebastian/diff (6.0.2)
  - Downloading sebastian/comparator (6.0.2)
  - Downloading sebastian/code-unit (3.0.1)
  - Downloading sebastian/cli-parser (3.0.2)
  - Downloading phpunit/php-timer (7.0.1)
  - Downloading phpunit/php-text-template (4.0.1)
  - Downloading phpunit/php-invoker (5.0.1)
  - Downloading phpunit/php-file-iterator (5.0.1)
  - Downloading theseer/tokenizer (1.2.3)
  - Downloading sebastian/lines-of-code (3.0.1)
  - Downloading sebastian/complexity (4.0.1)
  - Downloading sebastian/code-unit-reverse-lookup (4.0.1)
  - Downloading phpunit/php-code-coverage (11.0.5)
  - Downloading phar-io/version (3.2.1)
  - Downloading phar-io/manifest (2.0.4)
  - Downloading myclabs/deep-copy (1.12.0)
  - Downloading phpunit/phpunit (11.3.1)
  - Installing doctrine/inflector (2.0.10): Extracting archive
  - Installing doctrine/lexer (3.0.1): Extracting archive
  - Installing symfony/polyfill-ctype (v1.30.0): Extracting archive
  - Installing webmozart/assert (1.11.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.3.3): Extracting archive
  - Installing symfony/deprecation-contracts (v3.5.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.23.1): Extracting archive
  - Installing symfony/polyfill-php83 (v1.30.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.30.0): Extracting archive
  - Installing symfony/http-foundation (v7.1.3): Extracting archive
  - Installing fruitcake/php-cors (v1.3.0): Extracting archive
  - Installing psr/http-message (2.0): Extracting archive
  - Installing psr/http-client (1.0.3): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-factory (1.1.0): Extracting archive
  - Installing guzzlehttp/psr7 (2.7.0): Extracting archive
  - Installing guzzlehttp/promises (2.0.3): Extracting archive
  - Installing guzzlehttp/guzzle (7.9.2): Extracting archive
  - Installing symfony/polyfill-php80 (v1.30.0): Extracting archive
  - Installing guzzlehttp/uri-template (v1.0.3): Extracting archive
  - Installing laravel/pint (v1.17.2): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.30.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.30.0): Extracting archive
  - Installing symfony/string (v7.1.3): Extracting archive
  - Installing symfony/service-contracts (v3.5.0): Extracting archive
  - Installing symfony/console (v7.1.3): Extracting archive
  - Installing voku/portable-ascii (2.0.1): Extracting archive
  - Installing phpoption/phpoption (1.9.3): Extracting archive
  - Installing graham-campbell/result-type (v1.1.3): Extracting archive
  - Installing vlucas/phpdotenv (v5.6.1): Extracting archive
  - Installing symfony/css-selector (v7.1.1): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (v2.2.7): Extracting archive
  - Installing symfony/var-dumper (v7.1.3): Extracting archive
  - Installing symfony/polyfill-uuid (v1.30.0): Extracting archive
  - Installing symfony/uid (v7.1.1): Extracting archive
  - Installing symfony/routing (v7.1.3): Extracting archive
  - Installing symfony/process (v7.1.3): Extracting archive
  - Installing symfony/polyfill-php72 (v1.30.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.30.0): Extracting archive
  - Installing symfony/mime (v7.1.2): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.5.0): Extracting archive
  - Installing symfony/event-dispatcher (v7.1.1): Extracting archive
  - Installing psr/log (3.0.0): Extracting archive
  - Installing egulias/email-validator (4.0.2): Extracting archive
  - Installing symfony/mailer (v7.1.2): Extracting archive
  - Installing symfony/error-handler (v7.1.3): Extracting archive
  - Installing symfony/http-kernel (v7.1.3): Extracting archive
  - Installing symfony/finder (v7.1.3): Extracting archive
  - Installing ramsey/collection (2.0.0): Extracting archive
  - Installing brick/math (0.12.1): Extracting archive
  - Installing ramsey/uuid (4.7.6): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing nunomaduro/termwind (v2.0.1): Extracting archive
  - Installing symfony/translation-contracts (v3.5.0): Extracting archive
  - Installing symfony/translation (v7.1.3): Extracting archive
  - Installing psr/clock (1.0.0): Extracting archive
  - Installing symfony/clock (v7.1.1): Extracting archive
  - Installing carbonphp/carbon-doctrine-types (3.2.0): Extracting archive
  - Installing nesbot/carbon (3.7.0): Extracting archive
  - Installing monolog/monolog (3.7.0): Extracting archive
  - Installing league/mime-type-detection (1.15.0): Extracting archive
  - Installing league/flysystem (3.28.0): Extracting archive
  - Installing league/flysystem-local (3.28.0): Extracting archive
  - Installing nette/utils (v4.0.5): Extracting archive
  - Installing nette/schema (v1.3.0): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.3): Extracting archive
  - Installing league/config (v1.2.0): Extracting archive
  - Installing league/commonmark (2.5.3): Extracting archive
  - Installing laravel/serializable-closure (v1.3.4): Extracting archive
  - Installing laravel/prompts (v0.1.24): Extracting archive
  - Installing laravel/framework (v11.20.0): Extracting archive
  - Installing symfony/yaml (v7.1.1): Extracting archive
  - Installing laravel/sail (v1.31.1): Extracting archive
  - Installing nikic/php-parser (v5.1.0): Extracting archive
  - Installing psy/psysh (v0.12.4): Extracting archive
  - Installing laravel/tinker (v2.9.0): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
  - Installing mockery/mockery (1.6.12): Extracting archive
  - Installing filp/whoops (2.15.4): Extracting archive
  - Installing nunomaduro/collision (v8.4.0): Extracting archive
  - Installing sebastian/version (5.0.1): Extracting archive
  - Installing sebastian/type (5.0.1): Extracting archive
  - Installing sebastian/recursion-context (6.0.2): Extracting archive
  - Installing sebastian/object-reflector (4.0.1): Extracting archive
  - Installing sebastian/object-enumerator (6.0.1): Extracting archive
  - Installing sebastian/global-state (7.0.2): Extracting archive
  - Installing sebastian/exporter (6.1.3): Extracting archive
  - Installing sebastian/environment (7.2.0): Extracting archive
  - Installing sebastian/diff (6.0.2): Extracting archive
  - Installing sebastian/comparator (6.0.2): Extracting archive
  - Installing sebastian/code-unit (3.0.1): Extracting archive
  - Installing sebastian/cli-parser (3.0.2): Extracting archive
  - Installing phpunit/php-timer (7.0.1): Extracting archive
  - Installing phpunit/php-text-template (4.0.1): Extracting archive
  - Installing phpunit/php-invoker (5.0.1): Extracting archive
  - Installing phpunit/php-file-iterator (5.0.1): Extracting archive
  - Installing theseer/tokenizer (1.2.3): Extracting archive
  - Installing sebastian/lines-of-code (3.0.1): Extracting archive
  - Installing sebastian/complexity (4.0.1): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (4.0.1): Extracting archive
  - Installing phpunit/php-code-coverage (11.0.5): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.4): Extracting archive
  - Installing myclabs/deep-copy (1.12.0): Extracting archive
  - Installing phpunit/phpunit (11.3.1): Extracting archive
63 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/tinker ............................................................................. DONE
  nesbot/carbon .............................................................................. DONE
  nunomaduro/collision ....................................................................... DONE
  nunomaduro/termwind ........................................................................ DONE

79 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

   WARN  could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;).

インストールされるモジュール多いね。。
最後に警告がでているが、、(この後対応します)

Laravelの動作確認

Laravelのサーバーで起動してみる

> cd .\test-laravel\
> php artisan serve

   INFO  Server running on [http://127.0.0.1:8000].

  Press Ctrl+C to stop the server

ブラウザで http://127.0.0.1:8000 にアクセスしてみる。
エラーがでる。データベースの設定関係のようだ。
php.iniを再々度調整する

> vi php.ini

下記の行のコメントアウトを外す
extension=pdo_sqlite
extension=sqlite3

インストール時に最後の警告を出しているコマンドを実行してから、再度PHPでサーバを起動してみる

> php artisan migrate --graceful --ansi

   INFO  Preparing database.

  Creating migration table ............................................................ 9.50ms DONE

   INFO  Running migrations.

  0001_01_01_000000_create_users_table ............................................... 16.62ms DONE
  0001_01_01_000001_create_cache_table ................................................ 4.68ms DONE
  0001_01_01_000002_create_jobs_table ................................................ 12.14ms DONE

> php artisan serve

   INFO  Server running on [http://127.0.0.1:8000].

  Press Ctrl+C to stop the server

  2024-08-17 23:57:32 / ................................................................. ~ 0.17ms
  2024-08-17 23:57:32 /favicon.ico .................................................... ~ 510.82ms

ブラウザで http://127.0.0.1:8000 にアクセスしてみる。
表示されるようになりました。

Apacheで表示する

VirtualHostの設定をする

> cd scoop\persist\apache\conf
> vi httpd.conf

下記のIncludeの行のコメントアウトを外す
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

下記のDirectoryIndexにindex.phpを追加する
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

> cd extra
> vi httpd-vhosts.conf

下記を追記する
# test-laravel
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:/Users/tmacoto/Work/test-laravel/public"
    ServerName test-laravel.local
    <Directory "C:/Users/tmacoto/Work/test-laravel/public">
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/test-laravel.local-error.log"
    CustomLog "logs/test-laravel.local-access.log" common
</VirtualHost>

hostsファイルを管理者権限で編集する

> sudo vi C:\Windows\System32\drivers\etc\hosts

下記を追加
127.0.0.1       test-laravel.local

Apacheを再起動する

> sudo net stop apache
apache サービスを停止中です.
apache サービスは正常に停止されました。

> sudo net start apache
apache サービスを開始します.
apache サービスは正常に開始されました。

ブラウザで http://test-laravel.local にアクセスする

エラーがでる。さっきと同じデータベースの設定関係と同じ。
どうやら、Apache起動でPHPモジュールの読み込みに失敗しているようだ。。

PHPへのPathを設定しないとダメなようだ。

環境変数を編集

ユーザの環境変数
Path
新規
C:\Users\tmacoto\scoop\apps\php\current

サービスのApacheだとシステム環境変数を変更しないといけないみたい(やっていない)。
Scoopを使う理由の一つとして管理者権限が要らないということもあるので、サービスは使わないようにする。

ユーザのコマンドラインでApacheを起動する

> httpd

ブラウザで http://test-laravel.local にアクセスする
表示できました。

できたらやっぱりサービスで起動しておきたな。。

コメント