環境: windows,laravel8,docker,php7.3
環境構築に手間取っています。
#やりたいこと
phpの拡張機能gdをインストールして有効にしたい。
#やったこと
使用しているPCはwindows10で、新規で作成したlaravelプロジェクトをdcokerにビルドしました。
laravel excel ライブラリを使用したく、dockerコンテナ内で以下のコマンドを実行しました。
composer require maatwebsite/excel
しかし以下のエラーが出ました。
root@xxxxxxxxxxx:/var/www/laravel# composer require maatwebsite/excel PHP Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/gd.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ Using version ^3.1 for maatwebsite/excel ./composer.json has been updated Loading composer repositories with package information Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - maatwebsite/excel 3.1.28 requires phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0]. - maatwebsite/excel 3.1.29 requires phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0]. - maatwebsite/excel 3.1.30 requires phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0]. - maatwebsite/excel 3.1.33 requires phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0]. - maatwebsite/excel 3.1.0 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.1 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. ~中略~ - maatwebsite/excel 3.1.7 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.8 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.9 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0]. - maatwebsite/excel 3.1.x-dev requires phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0]. - phpoffice/phpspreadsheet 1.9.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. - phpoffice/phpspreadsheet 1.8.2 requires ext-gd * -> the requested PHP extension gd is missing from your system. - phpoffice/phpspreadsheet 1.8.1 requires ext-gd * -> the requested PHP extension gd is missing from your system. ~中略~ - phpoffice/phpspreadsheet 1.10.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. - phpoffice/phpspreadsheet 1.18.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. - phpoffice/phpspreadsheet 1.18.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. - Installation request for maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16, 3.1.17, 3.1.18, 3.1.19, 3.1.2, 3.1.20, 3.1.21, 3.1.22, 3.1.23, 3.1.24, 3.1.25, 3.1.26, 3.1.27, 3.1.28, 3.1.29, 3.1.3, 3.1.30, 3.1.31, 3.1.32, 3.1.33, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 3.1.x-dev]. To enable extensions, verify that they are enabled in your .ini files: - /usr/local/etc/php/php.ini - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini - /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode. Installation failed, reverting ./composer.json to its original content.
エラーを見るgdという拡張機能が有効ではないためエラーが起きているように見えます。
php.iniでは
extension=gd
となっておりextensionのディレクトリを見てみるとgdがないのでgdをインストール?する必要があるのですが、
調べると以下のコマンドでインストールできることがわかりました。
yum -y install php-gd
しかし当方使用しているPCがwindowsでyumコマンドが使えません。
yumコマンドもwindowsに導入する手段が見あたらず手詰まっております。
どうすればgdの拡張機能を導入できますでしょうか?
ご教授願いたいです。よろしくおねがいします。
回答1件
あなたの回答
tips
プレビュー