Ubuntu
PHP7.2
laravel5.5

UbuntuのPHP7.2でLaravel5.5をインストールするときにハマったエラー

環境

  • PHP 7.2
  • Ubuntu 14.04 (trusty)

手順

composerをインストールし、Laravelのインストールコマンドを実行する。
$ php composer.phar create-project laravel/laravel myblog --prefer-dist

Installing laravel/laravel (v5.5.0)
  - Installing laravel/laravel (v5.5.0): Downloading (100%)         
Created project in myblog
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework v5.5.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.5.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

・・・

PHP extensionのmbstringが無いよ、と言われた。

$ sudo apt-get install php7.2-mbstring

中途半端に作成されたmyblogディレクトリを消して、再度実行。
$ php composer.phar create-project laravel/laravel myblog --prefer-dist

Installing laravel/laravel (v5.5.0)
  - Installing laravel/laravel (v5.5.0): Loading from cache
Created project in myblog
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit 6.4.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.4.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.4.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.4.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.3.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.3.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.2.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.2.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.2.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.1.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.1.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.1.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 6.1.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.

・・・

今度は、PHP extensionのdomが無いよ、と言われた。
$ sudo apt-get install php7.2-dom

再度実行。
無事にLaravelをインストールできた。

参考サイト