PHP 在命令提示符中未被识别为内部或外部命令

标签 php cmd exe

当我使用 php

运行命令时出现以下错误
C:\xampp\htdocs>php
'php' is not recognized as an internal or external command,
operable program or batch file.

当我在以下路径中使用 php 运行命令时,我没有收到任何错误:

C:\xampp\php>php  //do not got error here

为什么会出现这个错误?

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

最佳答案

C:\xampp\php 添加到您的 PATH 环境变量中。(我的电脑->属性->高级系统设置->环境变量->路径(点击编辑))

然后关闭命令提示符并重新启动。

注意:关闭命令提示符并重新启动非常重要,否则更改将不会反射(reflect)。

关于PHP 在命令提示符中未被识别为内部或外部命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31291317/

相关文章:

php - 拍卖出价 - SELECT LOCK IN SHARE MODE 是否会保留最新信息?

php - Codeigniter 如果不存在则插入,如果不存在则更新

javascript - 使用Ajax和PHP插入数据库(mysql)

php - "Error establishing a database connection"是什么意思

c++ - 进程的退出代码是否会溢出小值?

visual-studio-2010 - Visual Studio : How to tell exe where to look for dll's?

java - 下载程序后无法通过进程运行程序(Java)

Linux 相当于 Windows 的 Net Use 命令

c++ - Visual C++ 2010 和 native 可执行文件

java - .exe 与从 Inno Setup 返回的 .exe 之间的差异 - 安装的应用程序失败