Symfony 5 - 需要信号量扩展(sysvsem)

Symfony 5 - Semaphore extension (sysvsem) is required

我已经实现了全新的 Symfony 身份验证系统:https://symfony.com/doc/current/security/experimental_authenticators.html

我添加了新的登录限制:https://symfony.com/blog/new-in-symfony-5-2-login-throttling

一切都已正确配置。

我还安装了 RateLimiter 组件,它创建了一个环境变量:

LOCK_DSN=semaphore

但是我有一个问题。首先,登录限制似乎被忽略了一半。一旦超过限制,我没有任何错误消息。另一方面,如果我尝试使用良好的凭据进行连接,则会出现以下错误:

Semaphore extension (sysvsem) is required.

我尝试安装信号量组件(https://symfony.com/doc/current/components/semaphore.html

但同样的问题。

这是我的security.yaml

security:
  enable_authenticator_manager: true

  encoders:
    App\Application\Entity\User:
      algorithm: auto

  # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  providers:
    in_memory: { memory: ~ }
    # used to reload user from session & other features (e.g. switch_user)
    in_database:
      entity:
        class: App\Application\Entity\User
        property: email
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false

    main:
      user_checker: App\Application\Security\UserChecker
      provider: in_database
      lazy: true

      remember_me:
        secret: '%kernel.secret%'

      form_login:
        login_path: app_login
        check_path: app_login
        default_target_path: home

      logout:
        path: app_logout
        target: app_login

      custom_authenticators:
        - App\Application\Security\AppCustomAuthenticator

      entry_point: App\Application\Security\AppCustomAuthenticator

      # configuring the maximum login attempts (per minute)
      login_throttling:
        max_attempts: 2

我搜索了是否有要添加到 PHP 的扩展程序,但没有找到任何内容。所以我不知道该怎么办。 我在 Windows 10

我也遇到了这个问题,你可以换store加锁: https://symfony.com/doc/current/components/lock.html#available-stores

我的解决方案是更改为 .env.local

###> symfony/lock ###
# Choose one of the stores below
# postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=semaphore
###< symfony/lock ###

至:

###> symfony/lock ###
# Choose one of the stores below
# postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=flock
###< symfony/lock ###

谢谢它对我有用

###> symfony/lock ###
# Choose one of the stores below
# postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=flock
###< symfony/lock ###