dongzi1209 2015-12-01 09:51
浏览 90

添加php.exe目录到“PATH”所以我可以在CMD上执行PHP不起作用! (WAMP)

I tried executing a php file using "php nameOfFile.php" after navigating to its folder.

I got this error msg:

php is not recognised as an internal or external command

I added this dir: C:\wamp\bin\php\php5.5.12 which contain php.exe to PATH ("Environment Variables")

reopened CMD and I still get the same error msg.

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.

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"

  • 写回答

1条回答 默认 最新

  • douyan2821 2015-12-01 10:07
    关注

    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, "
    "
        ;
    }
    

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集