LoginSignup
10
4

More than 3 years have passed since last update.

Docker + Laravel6 + Redis エラー: Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.

Last updated at Posted at 2019-09-04

Docker で構築した Laravel6 環境に Redis を導入した際にエラーになったので、その対応策を残します。

エラー内容

スクリーンショット 2019-09-04 15.50.23.png

Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.

環境

  • PHP 7.3
  • Laravel 6.0.0

公式ドキュメント

Before using Redis with Laravel, we encorage you to install and use the PhpRedis PHP extension via PECL. The extension is more complex to install but may yield better performance for applications that make heavy use of Redis.

PHP拡張機能の php-redis のインストールを推奨とのことです。
こちらを入れることによりパフォーマンスも向上しますよ。とのこと。

対応

Dockerfileの抜粋です。

FROM php:7.3-fpm-alpine

RUN apk add git
RUN git clone https://github.com/phpredis/phpredis.git /usr/src/php/ext/redis
RUN docker-php-ext-install redis

alpinegitコマンドが入ってないので、gitコマンドをインストールからやってます。
環境構築後は不要になるので、削除して良いですね。

実際のGitHubはコードはこちらです。
https://github.com/ucan-lab/docker-laravel/blob/master/docker/php/Dockerfile

10
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
4