为什么 Windows 上的 PHP 7.4 会中止所有需要用户输入的命令行操作? [英] Why does PHP 7.4 on Windows aborts all command line actions that require user input?

查看:35
本文介绍了为什么 Windows 上的 PHP 7.4 会中止所有需要用户输入的命令行操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地设置,用于在 3 台不同的 Windows 10 PC 上使用 Symfony 5.0 进行开发,当 PHP 版本为 7.3 时,所有这些都没有问题,而当 PHP 版本为 7.4 时,它们都出现相同的问题.

它发生在任何需要用户输入的执行中,例如:* php bin/console make:entity* php bin/console algorithm:migrations:migrate.

其他不需要用户输入的命令,如 php bin/console make:migration 工作正常,所以等待输入似乎是问题所在.

在非交互模式下运行它们适用于是/否,但对于像 make:entity

这样的很多人来说是不可能的

这是终端的输出:

PS C:\path\project>php bin/console make:entity要创建或更新的实体的类名(例如 VictoriousPuppy):>中止.make:entity [-a|--api-resource] [--regenerate] [--overwrite] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <命令>[<姓名>]PS C:\路径\项目>

中止立即发生,无需等待输入.我安装了 7.3 和 7.4 两个版本,切换到 7.3 使其工作正常,所以我查看了两个 php.ini 文件,但没有发现任何问题.我直接从 php.net 站点上的 Windows 下载链接安装它们 https://www.php.net/downloads.php

我的 PHP 版本安装在 C:\php\7.3C:\php\7.4 和切换它们我只需更改 windows 环境变量中的 PATH.php -v 如果我重新打开终端会产生正确的版本.

在 MacOS 上运行的团队成员在 7.4 上没有问题,在 Ubuntu 18.04 临时服务器上也没有问题,所以它必须是我的 Windows 安装所特有的.

解决方案

这是 PHP 7.4.0 for Windows 的一个错误.

该错误已在此处注册,并已在 7.4 中修复.1 版本,昨天 12 月 18 日发布.

只需下载最新的 PHP 版本,您就会没事的.>

I have a local setup for developing on Symfony 5.0 on 3 different Windows 10 PCs, and all of them have no issue when the PHP version is 7.3, and they all have this same issue when it is 7.4.

It happens on any execution which requires user input such as: * php bin/console make:entity * php bin/console doctrine:migrations:migrate.

Other commands like php bin/console make:migration which don't need user input work fine so it seems like the wait for input is the problem.

Running them in non-interactive mode works for the yes/no ones, but is impossible for a lot of them like make:entity

Here is the output from the terminal:

PS C:\path\project> php bin/console make:entity

 Class name of the entity to create or update (e.g. VictoriousPuppy):
 >

  Aborted.  


make:entity [-a|--api-resource] [--regenerate] [--overwrite] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name>]

PS C:\path\project>

The abort happens instantly with no wait for input. I have both versions 7.3 and 7.4 installed and switching to 7.3 makes it work fine, so I looked at both php.ini files and can't find anything wrong. I installed them directly from the Windows download links on the php.net site https://www.php.net/downloads.php

My PHP versions are installed in C:\php\7.3 and C:\php\7.4 and to switch them I just change the PATH in the windows environment variables. php -v produces the right version if I reopen terminal.

Team member running on MacOS has no problem with 7.4 and neither does the Ubuntu 18.04 staging server, so it must be something specific to my Windows install.

解决方案

This is a bug with PHP 7.4.0 for Windows.

The bug has been registered here, and has been fixed in the 7.4.1 version, released yesterday December 18th.

Just download the latest PHP version, and you'll be fine.

这篇关于为什么 Windows 上的 PHP 7.4 会中止所有需要用户输入的命令行操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆