dppcyt6157 2013-09-13 02:36
浏览 53
已采纳

在WAMP PHP Google+项目中安装Composer,无法识别PHP

I am following this PHP Google+ tutorial and I am trying to install composer in my WAMP directory

C:\wamp\www\gplus-quickstart-php>curl -s https://getcomposer.org/installer | php

but I'm getting this error

'php' is not recognized as an internal or external command operable program or batch file.

How do I resolve this problem? I already have PHP installed (via WAMP Server). Do I have to install PHP in my computer as well?

  • 写回答

6条回答 默认 最新

  • duanji1026 2013-09-13 12:32
    关注

    Ok a couple of things you need to do here.

    First windows does not have a curl processor like unix so you need to use the other option for installing Composer

    php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
    

    For this to work you need the php.exe processor to be on your path, so you have 2 options here. Either add the c:\wamp\bin\php\phpx.y.z folder to your PATH or my prefered option write yourself a little .cmd file which will do it for you like this

    addphp.cmd
    PATH=%PATH%;c:\wamp\bin\php\phpx.y.z
    

    Put this file in a folder already registered on your path so you can run it from anywhere in a command window.

    Now you will have to edit the \wamp\bin\php\phpx.y.z\php.ini file. This is similiar to the one used by php code run through the Apache web server but is only used by the PHP CLI (Command Line Interpreter)

    Make sure the extension php_curl is uncommented or the above line wont work i.e. remove the ; comment symbol

    extension=php_curl.dll
    

    So now run a command window, cd into the folder that you want composer installed into and run the command above, then follow the rest of the install instructions on Install instructions

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记