こんにちは
laravelの学習中にlinebotを作成しています。
その中で1つ躓いてた点があるので、同じことで悩んでいる方の助けになれば幸いです。
環境は以下です、
Windows10 home
laravel 5.8
#つまづいていたこと#
Linebotを作ろうとしたとき、SDKをインストールするときによく目にする
composer require linecorp/line-bot-sdk
を実行したのですが、私の環境では以下のようなログが出力されました。
>composer require linecorp/line-bot-sdk
Using version ^3.13 for linecorp/line-bot-sdk
./composer.json has been updated
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
- Installation request for linecorp/line-bot-sdk ^3.13 -> satisfiable by linecorp/line-bot-sdk[3.13.0].
- linecorp/line-bot-sdk 3.13.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.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.
Your requirements could not be resolved to an installable set of packages.
ようはSDKをインストールできていないんですね。。。
最初に調べたのは以下の質問
line-bot-sdk installがうまくいかない
この回答によると、拡張curlというのがインストールされていないとこと。
しかし、プロンプト上でphp -m
を入力したところ、curlは入っていたのでおそらく問題はないのかな?と判断。
次に見たのはエラー文中にある
linecorp/line-bot-sdk 3.13.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
ext-socketsなんちゃらと書いてあったので、php.iniを確認したところ、
extension=sockets
がコメントアウトしてあったので、解除したところ無事インストールできました!
拡張curlについてかなり調べていたので、数時間かかりましたが何とかLinebot作成することができそうです。
あまり似たような事象が出ている方が少ないせいか、調べても資料があまりでてこなかったのでどなたかの助けになれば幸いです。