‘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:
我的环境变量路径如下所示:
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公司\物理运算引擎\普遍;C:\程序文件\共同微软文件\ \ Windows Live;C:\ Program Files \电脑...............文件\ QTSystem \;:\ xampp \ php \ exe
I'm using Windows 7.
我使用Windows 7。
9 个解决方案
#1
23
I think you need to change it to A:\xampp\php\ and just leave it there, then it will search the directory for the file, also: have you tried calling just php instead of php.exe and check that the directory is correct.
我认为您需要将其更改为:\xampp\php,并将它放在那里,然后它将搜索该文件的目录,您是否尝试过只调用php而不是php。exe检查目录是否正确。
#2
43
A:\xampp\php\php.exe
The PATH environment variable must contain paths only, not file names.
PATH环境变量只能包含路径,而不是文件名。
Make that
使
A:\xampp\php
#3
29
it is very easy to do
You need to also add php.exe
Adding this path:
windows key + pause
click on Advance system settings
click Environment Variable
System variables part -> Path -> Edit and the add
C:\wamp\bin\php\php5.3.8;
close you cmd prompt if its open
It's Done!
您还需要添加php,这非常简单。exe添加这条路径:windows key +暂停点击Advance系统设置点击环境变量系统变量部分->路径->编辑和添加C:\wamp\bin\php\php5.3.8;关闭您的cmd提示,如果它打开它完成!
#4
16
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
注意:-在安装环境变量后,请重新启动计算机,这样它就可以正常工作了。
#5
6
Shouldn't the last part be: C:\xampp\php\
? Unless you remapped your drives, A is the floppy disk. :)
最后的部分不应该是:C:\xampp\php\ ?除非你重新启动你的硬盘,否则A是软盘。:)
Also, you need to specify the folder, not the exe file itself.
另外,您需要指定文件夹,而不是exe文件本身。
#6
4
My case am Using Bitnami Ruby Stack apache Web server ,
我的例子是使用Bitnami Ruby堆栈apache Web服务器,
- Pressed Windows key + Pause/Break Button
- 按下Windows键+暂停/断开按钮。
- Clicked advanced system settings
- 点击高级系统设置
- Click Environment Variables
- 点击环境变量
- Under System variables > edit PATH variable by adding C:\Bitnami\rubystack-1.9.3-24\php
- 在系统变量>编辑路径变量中添加C:\Bitnami\rubystack-1.9.3-24\php。
- Click Ok to close the Environment Variable window
- 单击Ok关闭环境变量窗口。
-
Close your command prompt if open
关闭命令提示符,如果打开。
*(Proceed to 7. to confirm if php is installed)
*(7。确认是否安装了php)
- Press Windows Key + R button to open your cmd
- 按Windows键+ R键打开cmd。
- Type php -v to view your php version
- 输入php -v来查看php版本。
#7
4
Set PHP as environment variable from System as below to run it from CMD
将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.
#8
2
If you have installed WAMP server, then your path can vary. For example, I installed WAMP and the path to my php.exe turned out to be:
如果您已经安装了WAMP服务器,那么您的路径可能会有所不同。例如,我安装了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:
为了使其工作,我在系统变量的路径变量中输入了以下路径:
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. 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
因此,路径可以根据安装PHP的方式而变化。如果您想要安装WAMP服务器,并让它安装其他重要的软件包,比如PHPMyAdmin等,那么您可以从:wampserver.com。
#9
1
In my case, environment path is C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\Php;
and it works for me.
在我的例子中,环境路径是C:\ProgramData\Drush\;C:\程序文件(x86)\Drush\Php;这对我很有效。
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.
我希望遇到这个问题的人可以试试这个建议。
#1
23
I think you need to change it to A:\xampp\php\ and just leave it there, then it will search the directory for the file, also: have you tried calling just php instead of php.exe and check that the directory is correct.
我认为您需要将其更改为:\xampp\php,并将它放在那里,然后它将搜索该文件的目录,您是否尝试过只调用php而不是php。exe检查目录是否正确。
#2
43
A:\xampp\php\php.exe
The PATH environment variable must contain paths only, not file names.
PATH环境变量只能包含路径,而不是文件名。
Make that
使
A:\xampp\php
#3
29
it is very easy to do
You need to also add php.exe
Adding this path:
windows key + pause
click on Advance system settings
click Environment Variable
System variables part -> Path -> Edit and the add
C:\wamp\bin\php\php5.3.8;
close you cmd prompt if its open
It's Done!
您还需要添加php,这非常简单。exe添加这条路径:windows key +暂停点击Advance系统设置点击环境变量系统变量部分->路径->编辑和添加C:\wamp\bin\php\php5.3.8;关闭您的cmd提示,如果它打开它完成!
#4
16
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
注意:-在安装环境变量后,请重新启动计算机,这样它就可以正常工作了。
#5
6
Shouldn't the last part be: C:\xampp\php\
? Unless you remapped your drives, A is the floppy disk. :)
最后的部分不应该是:C:\xampp\php\ ?除非你重新启动你的硬盘,否则A是软盘。:)
Also, you need to specify the folder, not the exe file itself.
另外,您需要指定文件夹,而不是exe文件本身。
#6
4
My case am Using Bitnami Ruby Stack apache Web server ,
我的例子是使用Bitnami Ruby堆栈apache Web服务器,
- Pressed Windows key + Pause/Break Button
- 按下Windows键+暂停/断开按钮。
- Clicked advanced system settings
- 点击高级系统设置
- Click Environment Variables
- 点击环境变量
- Under System variables > edit PATH variable by adding C:\Bitnami\rubystack-1.9.3-24\php
- 在系统变量>编辑路径变量中添加C:\Bitnami\rubystack-1.9.3-24\php。
- Click Ok to close the Environment Variable window
- 单击Ok关闭环境变量窗口。
-
Close your command prompt if open
关闭命令提示符,如果打开。
*(Proceed to 7. to confirm if php is installed)
*(7。确认是否安装了php)
- Press Windows Key + R button to open your cmd
- 按Windows键+ R键打开cmd。
- Type php -v to view your php version
- 输入php -v来查看php版本。
#7
4
Set PHP as environment variable from System as below to run it from CMD
将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.
#8
2
If you have installed WAMP server, then your path can vary. For example, I installed WAMP and the path to my php.exe turned out to be:
如果您已经安装了WAMP服务器,那么您的路径可能会有所不同。例如,我安装了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:
为了使其工作,我在系统变量的路径变量中输入了以下路径:
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. 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
因此,路径可以根据安装PHP的方式而变化。如果您想要安装WAMP服务器,并让它安装其他重要的软件包,比如PHPMyAdmin等,那么您可以从:wampserver.com。
#9
1
In my case, environment path is C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\Php;
and it works for me.
在我的例子中,环境路径是C:\ProgramData\Drush\;C:\程序文件(x86)\Drush\Php;这对我很有效。
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.
我希望遇到这个问题的人可以试试这个建议。