php - 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. 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. 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. 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,需要重新启动我的计算机。非常感谢李健!
推荐阅读
- python - 如何使用数据提供程序在 python 中读取 excel 文件
- firebase - 我可以在 ReactNative 项目中同时使用 'react-native-firebase' 和 'firebase' 吗?
- python-3.x - 是否可以使用 Python(PyUSB)获取 USB 设备节点(文件)?
- javascript - Javascript错误的计算和舍入数字
- linux - 如何从正在运行的程序的输出中只显示我想要的数据?
- c - 如何在 C 中请求无限的用户输入?
- c# - Unity 中的脚本问题
- mysql - MySQL SELECT、UNION、JOIN 查询优化
- flask - 如何从 Flask-WTF 中的 BooleanField 获取值?
- c# - 是否有将以下 LINQ 查询语法转换为使用 Lambda 的方法语法的解决方案