Docker:Smarty環境を作る

Docker:Compose環境を作る」の続き
Composerを使ってSmartyをインストールしてみる


Smartyのインストール

1. PHPコンテナに接続
docker container exec -it php bash

2. "composer require smarty/smarty" でSmartyをインストール
root@8f2ee824c8e9:/var/www/html# composer require smarty/smarty
Using version ^4.0 for smarty/smarty
./composer.json has been updated
Running composer update smarty/smarty
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
    Failed to download smarty/smarty from dist: The zip extension and unzip/7z commands are both missing, skipping.
Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
    Now trying to download from source


  [RuntimeException]
  git was not found in your PATH, skipping source download


require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] []...

エラーになってしまった。
zip/unzipコマンドが無い?

3. zip/unzipコマンドインストール
以下コマンドでzipとunzipをインストールする
"apt update"
"apt install zip unzip"
root@8f2ee824c8e9:/var/www/html# apt install zip unzip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  unzip zip
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 403 kB of archives.
After this operation, 1032 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 unzip amd64 6.0-26 [171 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 zip amd64 3.0-12 [232 kB]
Fetched 403 kB in 0s (1216 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ... 14072 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-26_amd64.deb ...
Unpacking unzip (6.0-26) ...
Selecting previously unselected package zip.
Preparing to unpack .../archives/zip_3.0-12_amd64.deb ...
Unpacking zip (3.0-12) ...
Setting up unzip (6.0-26) ...
Setting up zip (3.0-12) ...
Processing triggers for mailcap (3.69) ...

4. もういちどsmartyをインストールしてみる
root@8f2ee824c8e9:/var/www/html# composer require smarty/smarty
Using version ^4.0 for smarty/smarty
./composer.json has been updated
Running composer update smarty/smarty
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading smarty/smarty (v4.0.0)
  - Installing smarty/smarty (v4.0.0): Extracting archive
Generating autoload files

今度は成功したようだ


Docker, Composer, Smarty

0 件のコメント:

その他の記事