沃梦达 / 编程问答 / php问题 / 正文

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

PHP is not recognized as an internal or external command in command prompt(PHP 在命令提示符中未被识别为内部或外部命令)

本文介绍了PHP 在命令提示符中未被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 php

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

在以下路径中使用 php 运行命令时没有出现任何错误:

I don't get any error when I run the command with php in following path:

C:xamppphp>php  //do not got error here

为什么会出现这个错误?

Why I get this error?

'php' 不是内部或外部命令,也不是可运行的程序或批处理文件.

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

推荐答案

C:xamppphp 添加到您的 PATH 环境变量中.(My Computer->属性->高级系统设置->环境变量->编辑路径)

Add C:xamppphp to your PATH environment variable.(My Computer->properties -> Advanced system setting-> Environment Variables->edit path)

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

Then close your command prompt and restart again.

注意:关闭命令提示符并重新启动非常重要,否则将不会反映更改.

Note: It's very important to close your command prompt and restart again otherwise changes will not be reflected.

这篇关于PHP 在命令提示符中未被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:PHP 在命令提示符中未被识别为内部或外部命令

基础教程推荐