PhpStorm - WSL2 - PHPUnit - 配置 CLI 解释器

PhpStorm - WSL2 - PHPUnit - Configure CLI Interpreter

我从 Windows 10.

升级到 WSL2

使用 PhpStorm,在我切换到 WSL 下的项目中,我尝试启动 PHPUnit。但是我有这个错误:

Error in bootstrap script:
Symfony\Component\Dotenv\Exception\PathException: Unable to read the "\WSL$\UBUNTU\home\toto\symfony\myProject/.env" environment file.

通过查看 CLI 解释器级别的参数,我发现还有我的 Windows 配置:

因此,如果存在问题,我想我必须确保从我的 WSL 中获取 PHP 可执行文件。除了..不可能找到它 我在 usr/bin/phpusr/bin/php7.4 中有文件,但均未被接受。在 \etc\php.4 中,我有这 3 个文件夹:

但是一样,里面没有什么可以接受的。

您正在使用 PHP 本地类型的解释器,而您需要使用 WSL 类型。这是 UI 的样子:

点击+图标,选择From Docker, Vagrant, VM, WSL, Remote...,然后在里面选择WSL