简体   繁体   English

当我在 Windows 上运行 composer 时,我收到一个错误“php.exe”不是内部或外部命令、可运行程序或批处理文件。

[英]When I run composer on Windows, I get an error of 'php.exe' is not recognized as an internal or external command, operable program or batch file.'

I have an install of Acquia Dev Desktop 2 for local Drupal development, which comes with PHP and some tools like composer and drush.我为本地 Drupal 开发安装了 Acquia Dev Desktop 2,它附带 PHP 和一些工具,如 composer 和 drush。 However, when I run composer, it gives me the error:但是,当我运行作曲家时,它给了我错误:

'php.exe' is not recognized as an internal or external command,
operable program or batch file.

I have already seen many other similar questions on here, which universally say that php needs to be added to the PATH.我已经在这里看到了许多其他类似的问题,普遍认为 php 需要添加到 PATH 中。 However, I have already done this adding:但是,我已经完成了这个添加:

C:\Program Files (x86)\DevDesktop\php7_3_x64
C:\Program Files (x86)\DevDesktop\tools //contains Composer and Drush

This results in me being able to run php and php.exe from Git Bash fine, but if I try composer the aforementioned error still crops up. This results in me being able to run php and php.exe from Git Bash fine, but if I try composer the aforementioned error still crops up. It's not working on Powershell, cmd or git bash for windows, but I am in particular trying to get it to work on Git Bash so here is my.bashrc. It's not working on Powershell, cmd or git bash for windows, but I am in particular trying to get it to work on Git Bash so here is my.bashrc. I've tried lots of other variations, but to no avail.我尝试了很多其他变体,但无济于事。

alias php='php.exe'
alias php.exe=\'C:/Program\ Files\ \(x86\)\\DevDesktop\\php7_3_x64\\php.exe\'
alias drush='drush.bat'
alias composer='composer.bat'

I'm at a loss on what steps to take, so any insight would be greatly appreciated!我不知道要采取什么步骤,所以任何见解都将不胜感激!

D'oh, needed to restart my computer. D'oh,需要重新启动我的计算机。 Many thanks to Ken Lee!非常感谢李健!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 '“php.exe”'无法识别为内部或外部命令,可运行程序或批处理文件 - '“php.exe”' is not recognized as an internal or external command, operable program or batch file 'php.exe' 不是内部或外部命令,也不是可运行的程序或批处理文件 - ‘php.exe’ is not recognized as an internal or external command, operable program or batch file 当执行Composer命令时,错误“'php'未被识别为内部或外部命令,可操作程序或批处理文件” - When executing Composer commands error “'php' is not recognized as an internal or external command, operable program or batch file” 'python' 不是内部或外部命令,也不是可运行的程序或批处理文件。 运行 PHP shell_exec 时出错 - 'python' is not recognized as an internal or external command, operable program or batch file. error when running PHP shell_exec 错误:'php'未被识别为内部或外部命令,可操作程序或批处理文件 - Error: 'php' is not recognized as an internal or external command, operable program or batch file phpunit 从命令行运行返回“'phpunit' 不是内部或外部命令、可运行程序或批处理文件。” - phpunit run from command line returns “'phpunit' is not recognized as an internal or external command, operable program or batch file.” 无法将“ composer”识别为内部或外部命令,可操作程序或批处理文件 - 'composer' is not recognized as an internal or external command, operable program or batch file 数组(PHP中的数组([0] =>'c:\\ Program'不被识别为内部或外部命令,[1] =>可操作程序或批处理文件。) - Array ( [0] => 'c:\Program' is not recognized as an internal or external command, [1] => operable program or batch file. ) in php 如何解决“ php”未识别为内部或外部命令,可操作程序或批处理文件 - How do I solve 'php' is not recognized as an internal or external command, operable program or batch file 无法将“ php”识别为内部或外部命令,可操作程序或批处理文件 - 'php' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM