[英]Adding php.exe directory to “PATH” so I can execute PHP on CMD isn't working! (WAMP)
I tried executing a php file using "php nameOfFile.php" after navigating to its folder. 导航到其文件夹后,我尝试使用“ php nameOfFile.php”执行一个php文件。
I got this error msg: 我收到此错误消息:
php is not recognised as an internal or external command
php无法识别为内部或外部命令
I added this dir: C:\\wamp\\bin\\php\\php5.5.12
which contain php.exe
to PATH ("Environment Variables") 我添加了这个目录:
C:\\wamp\\bin\\php\\php5.5.12
,其中包含php.exe
到PATH(“环境变量”)
reopened CMD and I still get the same error msg. 重新打开CMD,我仍然收到相同的错误消息。
googling this error doesn't help me because all do the same. 谷歌搜索此错误对我没有帮助,因为所有操作都相同。
EDIT: 编辑:
When navigating to the bin/php/php5.5.12 and running php --version
I get the version output right. 当导航到bin / php / php5.5.12并运行
php --version
我得到正确的版本输出。
When running the same on the main C:/ I get the first error back again "php is not recognised as an internal or external command" 当在主C:/上运行相同命令时,我再次得到第一个错误“ php不被识别为内部或外部命令”
Not an answer (yet), but unconvinient as a comment: 还没有答案,但不便于评论:
Can please run 能跑吗
<?php
foreach( explode(';', $_ENV['Path']) as $p ) {
echo
false!==stripos($p, 'php') ? '>':' ',
is_dir($p) ? '+':'-',
file_exists($p.'\\php.exe') ? '#': ' ',
$p, "\r\n"
;
}
from the console* and add the output to your question text? 从控制台*并将输出添加到您的问题文本?
The output should look like 输出应该看起来像
[...]
+ C:\Program Files\Microsoft\Web Platform Installer\
+ C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\
+ C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
+ C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
>+#c:\develop\php
*) the way you did it for your "EDIT:" section. *)在“编辑:”部分中的操作方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.