Lando, PHP 8 and Drupal 9: memcache not found issue

I have been working on a Drupal website for several months. The environment is created with Lando, a cross platform development tool. It helps us to maintain the required environment for Drupal and to facilitate our custom development.

Error message

However, I faced a weird issue. After I had rebuilt the Docker images with Lando, the Drupal site returned an error message, saying that memcache extension is not found.

Drupal\memcache\MemcacheException: No Memcache extension found in 
Drupal\memcache\Driver\MemcacheDriverFactory->initialize() (line 172 of modules/contrib/memcache/src/Driver/MemcacheDriverFactory.php).
My error message

If I didn't configured the error logging level to verbose, it will only show a simple error message.

The website encountered an unexpected error. Please try again later.

Steps to enable verbose error logging level

This greatly helps to debug and finding the culprit of problem. You need to add a parameter to settings.php or settings.local.php.

$config['system.logging']['error_level'] = 'verbose';

Don't include this config in production environment.

When did it happened?

It happened after our Drupal development project had been upgraded to PHP 8.

Solution

I upgraded my local Lando software version to 3.6.4 by following the guide provided by Lando team. It solved the problem flawlessly, without any additional config.

Installation
Get the skinny on how to easily install Lando, a local development and DevOps tool, on macOS, Windows and Linux.

I followed the steps for Debian, as I am using Ubuntu 20.04.

Why?

I used APT package manager to install and upgrade Lando. However, that APT version was no longer being maintained. Therefore, my local Lando version was so outdated, 3.1.x, it did not supported PHP 8.

Conclusion

Remember to upgrade your development tools to latest version, before spending hours to search for solutions and rebuilding Docker images.