sail: Unable to start due to missing PHP Redis Extension

  • Sail Version: 1.12.9
  • Laravel Version: 8.74.0
  • PHP Version: 8.0
  • OS: Windows 10

Description:

All of our docker installs throughout the company are failing due to PHP Redis not being available inside the docker image.

C:\WORKINGPATH>docker run --rm -v "C:\Projects\Dashboard:/opt" -w /opt laravelsail/php80-composer:latest composer install --ignore-platform-reqs
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   LogicException

  Please make sure the PHP Redis extension is installed and enabled.

  at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:77
     73▕     protected function createClient(array $config)
     74▕     {
     75▕         return tap(new Redis, function ($client) use ($config) {
     76▕             if ($client instanceof RedisFacade) {
  ➜  77▕                 throw new LogicException(
     78▕                     extension_loaded('redis')
     79▕                         ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
     80▕                         : 'Please make sure the PHP Redis extension is installed and enabled.'
     81▕                 );

      +21 vendor frames
  22  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Laravel\Telescope\TelescopeServiceProvider))

      +5 vendor frames
  28  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Trying to run using the following batch file -

docker run --rm -v "%cd%:/opt" -w /opt laravelsail/php80-composer:latest composer install --ignore-platform-reqs

Steps To Reproduce:

Try to run the above command using Docker, downloads latest image, then fails to run due to PHP-Redis being missing. Happening on 4 developer machines at present.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I’m also experience the error. In my case the problem is that php for some reason is 8.1 instead of 8.0

After sail build --no-cache && sail up:

stan@thinkpad:~/www/projectx$ sail shell
sail@de41c47ee716:/var/www/html$ php -v
PHP 8.1.1 (cli) (built: Dec 31 2021 07:26:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
sail@de41c47ee716:/var/www/html$ which php
/usr/bin/php
sail@de41c47ee716:/var/www/html$ php8.
php8.0  php8.1
sail@de41c47ee716:/var/www/html$ php8.0 -v
PHP 8.0.14 (cli) (built: Dec 20 2021 21:23:16) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
sail@de41c47ee716:/var/www/html$

Sail Version: 1.13 Laravel Version: 8.77.1 OS: Windows 10 + WSL2

docker-compose.yml:

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.0
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.0/app
        ports:
            - '${APP_PORT:-80}:80'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - mysql
            - redis
...