[英]PHP7 not installing to the command line
我最近在计算机上安装了PHP 7,以帮助创建带有python的测试网站。 它已全部安装,Visual Studio在其path变量中接受文件。 但是,当尝试从命令行运行PHP命令时,它似乎不起作用。
例:
Microsoft Windows [Version 10.0.17134.165]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\userName>php -a
'php' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\userName>
我知道这不是命令提示符的问题,因为我已经安装了Java和Python:
Python示例:
C:\Users\userName>py
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print "This works!"
This works!
>>>
同样,我可以运行java命令:
C:\Users\userName>java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+180)
Java HotSpot(TM) 64-Bit Server VM (build 9+180, mixed mode)
C:\Users\userName>
我找到了解决该问题的临时解决方案,该解决方案要求每次我想编写PHP命令时都设置一个路径:
C:\Users\userName>path C:\Program Files\PHP7
C:\Users\userName>php -a
Interactive shell
php > echo "This works!";
This works!
php >
我如何永久解决此问题的任何答案将不胜感激!
如果您想直接在命令“ php”中使用它,则必须将路径环境变量设置为php。
我认为这将对您有所帮助: 如何在Windows上使用命令行访问PHP?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.