Installing Composer in WAMP PHP Google+ Project, PHP is not recognised

后端 未结 6 1981
予麋鹿
予麋鹿 2021-01-06 18:39

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://getc         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 19:11

    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 thats the bad option for WAMPServer as you can have more than one version of PHP installed and when you activate another version your PATH will still be pointing at the Old version. Or my prefered option write yourself a little .cmd file which will do it for you like this

    filename = 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

提交回复
热议问题