Composer 安装失败 Digitalocean 虚拟主机

Composer install fail Digitalocean web hosting

我做了什么:

  1. SSH 设置
  2. Php7.2 已安装
  3. 已安装 apache2
  4. 从 GitLab 拉取文件

当我 运行 这个 apt install Composer

root@sewa:~/sewa# apt install composer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
composer is already the newest version (1.6.3-1).
0 upgraded, 0 newly installed, 0 to remove and 26 not upgraded.

但是当我 运行 composer install 出现这样的错误消息时我无法安装 composer

root@sewa:~/sewa# composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for dompdf/dompdf v0.8.5 -> satisfiable by dompdf/dompdf[v0.8.5].
    - dompdf/dompdf v0.8.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 2
    - Installation request for laravel/framework v6.18.2 -> satisfiable by laravel/framework[v6.18.2].
    - laravel/framework v6.18.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 3
    - Installation request for league/commonmark 1.3.1 -> satisfiable by league/commonmark[1.3.1].
    - league/commonmark 1.3.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 4
    - 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.
  Problem 5
    - Installation request for facade/ignition 1.16.1 -> satisfiable by facade/ignition[1.16.1].
    - facade/ignition 1.16.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 6
    - Installation request for phar-io/manifest 1.0.3 -> satisfiable by phar-io/manifest[1.0.3].
    - phar-io/manifest 1.0.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 7
    - Installation request for phpunit/php-code-coverage 7.0.10 -> satisfiable by phpunit/php-code-coverage[7.0.10].
    - phpunit/php-code-coverage 7.0.10 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 8
    - Installation request for phpunit/phpunit 8.5.2 -> satisfiable by phpunit/phpunit[8.5.2].
    - phpunit/phpunit 8.5.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 9
    - Installation request for scrivo/highlight.php v9.18.1.1 -> satisfiable by scrivo/highlight.php[v9.18.1.1].
    - scrivo/highlight.php v9.18.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 10
    - Installation request for theseer/tokenizer 1.1.3 -> satisfiable by theseer/tokenizer[1.1.3].
    - theseer/tokenizer 1.1.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 11
    - dompdf/dompdf v0.8.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - barryvdh/laravel-dompdf v0.8.6 requires dompdf/dompdf ^0.8 -> satisfiable by dompdf/dompdf[v0.8.5].
    - Installation request for barryvdh/laravel-dompdf v0.8.6 -> satisfiable by barryvdh/laravel-dompdf[v0.8.6].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.2/cli/php.ini
    - /etc/php/7.2/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.2/cli/conf.d/10-opcache.ini
    - /etc/php/7.2/cli/conf.d/10-pdo.ini
    - /etc/php/7.2/cli/conf.d/20-apcu.ini
    - /etc/php/7.2/cli/conf.d/20-apcu_bc.ini
    - /etc/php/7.2/cli/conf.d/20-calendar.ini
    - /etc/php/7.2/cli/conf.d/20-ctype.ini
    - /etc/php/7.2/cli/conf.d/20-exif.ini
    - /etc/php/7.2/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.2/cli/conf.d/20-ftp.ini
    - /etc/php/7.2/cli/conf.d/20-gd.ini
    - /etc/php/7.2/cli/conf.d/20-gettext.ini
    - /etc/php/7.2/cli/conf.d/20-iconv.ini
    - /etc/php/7.2/cli/conf.d/20-json.ini
    - /etc/php/7.2/cli/conf.d/20-mysqli.ini
    - /etc/php/7.2/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.2/cli/conf.d/20-phar.ini
    - /etc/php/7.2/cli/conf.d/20-posix.ini
    - /etc/php/7.2/cli/conf.d/20-readline.ini
    - /etc/php/7.2/cli/conf.d/20-shmop.ini
    - /etc/php/7.2/cli/conf.d/20-sockets.ini
    - /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.2/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.2/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.2/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

我想解决这个错误

安装以下 php 个扩展 -

php7.2-mbstring php7.2-dom

运行下面的命令来安装它们-

sudo apt install php7.2-mbstring php7.2-dom

然后重新启动 apache -

sudo systemctl reload apache2