[英]‘php.exe’ is not recognized as an internal or external command, operable program or batch file
'php.exe' is not recognized as an internal or external command, operable program or batch file.
'php.exe' 不是内部或外部命令,也不是可运行的程序或批处理文件。
Why does that error occur even though I've added PHP to my environment variables?即使我已将 PHP 添加到我的环境变量中,为什么会发生该错误?
My environment variable PATH is shown below:我的环境变量PATH如下所示:
C:\\Program Files\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files\\PC ............... Files\\QTSystem\\;A:\\xampp\\php\\php.exe
C:\\Program Files\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files\\PC ..................... Files\\QTSystem\\;A:\\xampp\\php\\php.exe
I'm using Windows 7.我正在使用 Windows 7。
A:\xampp\php\php.exe
The PATH environment variable must contain paths only, not file names. PATH 环境变量必须只包含路径,而不是文件名。
Make that做那个
A:\xampp\php
it is very easy to do这很容易做到
You need to also add php.exe您还需要添加 php.exe
Adding this path:添加此路径:
windows key + pause windows键+暂停
click on Advance system settings点击高级系统设置
click Environment Variable单击环境变量
System variables part -> Path -> Edit and the add系统变量部分 -> 路径 -> 编辑和添加
C:\\wamp\\bin\\php\\php5.3.8; C:\\wamp\\bin\\php\\php5.3.8;
close you cmd prompt if its open如果它打开,请关闭你的 cmd 提示
It's Done!完成!
我认为您需要将其更改为 A:\\xampp\\php\\ 并将其留在那里,然后它将搜索该文件的目录,还有:您是否尝试仅调用 php 而不是 php.exe 并检查该目录是否为正确的。
View above screen shot for setup enviroment variable in window 7在窗口 7 中查看上面设置环境变量的屏幕截图
Note:- After setup enviroment variable please restart you computer then its will work fine注意:-设置环境变量后,请重新启动计算机,然后它会正常工作
Shouldn't the last part be: C:\\xampp\\php\\
?最后一部分不应该是:
C:\\xampp\\php\\
吗? Unless you remapped your drives, A is the floppy disk.除非您重新映射驱动器,否则 A 是软盘。 :)
:)
Also, you need to specify the folder, not the exe file itself.此外,您需要指定文件夹,而不是 exe 文件本身。
My case am Using Bitnami Ruby Stack apache Web server ,我的情况是使用 Bitnami Ruby Stack apache Web 服务器,
Close your command prompt if open如果打开,请关闭命令提示符
*(Proceed to 7. to confirm if php is installed) *(进入7.确认是否安装了php)
Set PHP as environment variable from System as below to run it from CMD如下从 System 设置 PHP 作为环境变量以从 CMD 运行它
1)Windows key + Pause
2)Click on Advanced system settings
3)Now click on Environment Variables.. button
4)In system variable section search for Path and edit it as D:\wamp\bin\php\php5.3.13;(If one needs to append it to some already exits value then start path with;)
5)Now open CMD and run command PHP from any path where you don’t have PHP installed , in my case it’s C drive.
6)We can check above set Path from CMD using Path command also.
If you have installed WAMP server, then your path can vary.如果您安装了 WAMP 服务器,那么您的路径可能会有所不同。 For example, I installed WAMP and the path to my php.exe turned out to be:
例如,我安装了 WAMP,结果我的 php.exe 的路径是:
C:\wamp\bin\php\php5.5.12\php.exe
To make it work, I entered the following path in the PATH variable of the System Variables:为了使它工作,我在系统变量的 PATH 变量中输入了以下路径:
C:\wamp\bin\php\php5.5.12
Once done, I restarted command prompt and everything worked fine.完成后,我重新启动命令提示符,一切正常。
So the path can vary depending upon how you installed PHP.因此,路径可能因您安装 PHP 的方式而异。 If you would like to install WAMP server and have it install other essential packages like PHPMyAdmin, etc. you may do so from: wampserver.com
如果您想安装 WAMP 服务器并让它安装其他基本软件包,例如 PHPMyAdmin 等,您可以从以下网址进行操作: wampserver.com
In my case, environment path is C:\\ProgramData\\Drush\\;C:\\Program Files (x86)\\Drush\\Php;
就我而言,环境路径是
C:\\ProgramData\\Drush\\;C:\\Program Files (x86)\\Drush\\Php;
and it works for me.它对我有用。
If I simply add C:\\xampp\\php\\
dint work for me.如果我只是添加
C:\\xampp\\php\\
dint 为我工作。
I hope if someone facing this issue can try this suggestion.我希望如果有人遇到这个问题可以尝试这个建议。
This happened to me and I found why.这发生在我身上,我找到了原因。
Xampp can't run properly depending on your UAC settings.根据您的 UAC 设置,Xampp 无法正常运行。
Try to do this:尝试这样做:
Log in as administrator (running cmd.exe as administrator isn't enough)以管理员身份登录(以管理员身份运行 cmd.exe 是不够的)
Execute cmd.exe or equivalent执行 cmd.exe 或等效的
type php -version输入 php -version
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.