php : 术语“php”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19124930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 18:51:56  来源:igfitidea点击:

php : The term 'php' is not recognized as the name of a cmdlet, function, script file, or operable program

phpwindowsgitlaravellaravel-4

提问by Chris

I am trying to install and setup Laravel 4 through the Git Shell using thistutorial:

我正在尝试使用教程通过 Git Shell 安装和设置 Laravel 4 :

It all seems to be working until I have to run php artisan key:generateat which point it gives me the error:

这一切似乎都在工作,直到我必须运行php artisan key:generate,此时它给了我错误:

php : The term 'php' is not recognized as the name of a cmdlet, function, script file, or operable program

php : 术语“php”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

I have hunted around and am not sure how to go about setting this up so it recognizes PHP.

我四处寻找,但不知道如何设置它以便它识别 PHP。

Does anyone have any ideas or know of a thorough tutorial to get Laravel 4 setup?

有没有人有任何想法或知道获得 Laravel 4 设置的详尽教程?

回答by Aristona

Try adding your PHP.exe's folder to your System PATH variables, so PHP can be accessed via terminal.

尝试将您PHP.exe的文件夹添加到您的System PATH variables,以便可以通过终端访问 PHP。

For example; C:\wamp\bin\php\php5.4.3

例如; C:\wamp\bin\php\php5.4.3

To add new PATH variable, follow this:

要添加 new PATH variable,请按照以下步骤操作:

  1. Right click on My Computer, select Properties
  2. Select Advanced System Settings
  3. In the System Properties windowclick the Environment Variables button.
  4. Select System Variables -> PATHand click Edit.
  5. Enter the folder where your PHP.exeis located.
  1. 右键单击My Computer,选择Properties
  2. 选择 Advanced System Settings
  3. System Properties window单击Environment Variables button.
  4. 选择System Variables -> PATH并单击编辑。
  5. 输入您所在的文件夹PHP.exe

If you did this correctly, restart your terminal and type php --versionto check if it works.

如果您正确执行此操作,请重新启动终端并键入php --version以检查它是否有效。

Note:Don't forget to seperate paths by using ;seperator.

注意:不要忘记使用;分隔符分隔路径。