linux下php源composer的安装

版权声明:本文为博主原创文章,转载请留言。 https://blog.csdn.net/root_miss/article/details/83026022

linux下php源composer的安装

linux 全局安装composer

1 、下载composer

curl -sS https://getcomposer.org/installer | php

2 、将composer.phar文件移动到bin目录以便全局使用composer命令

mv composer.phar /usr/local/bin/composer

3、切换国内源

composer config -g repo.packagist composer https://packagist.phpcomposer.com

4、在项目更目录下使用

composer install

composer install 安装报错

composer install遇到错误:Your requirements could not be resolved to an installable set of packages. 这是因为不匹配composer.json要求的版本。


vagrant@homestead:/usr/share/nginx/html/laravel-blog$ sudocomposerinstall
Loadingcomposerrepositorieswithpackage information
Installingdependencies (includingrequire-dev) fromlockfile
Yourrequirementscouldnot beresolvedto aninstallablesetofpackages.
 
  Problem 1
    - Installationrequestfor doctrine/instantiator 1.0.3 -> satisfiablebydoctrine/instantiator[1.0.3].
    - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement.
  Problem 2
    - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement.
    - phpunit/phpunit-mock-objects 2.3.0 requiresdoctrine/instantiator ~1.0,>=1.0.1 -> satisfiablebydoctrine/instantiator[1.0.3].
    - Installationrequestfor phpunit/phpunit-mock-objects 2.3.0 -> satisfiablebyphpunit/phpunit-mock-objects[2.3.0].
    -
  ...............................

解决:
提示 PHP 7版本太高,不符合composer.json需要的版本,但是在PHP 7下应该也是可以运行的,composer可以设置忽略版本匹配,命令是:

composerinstall --ignore-platform-reqs 或者 composerupdate --ignore-platform-reqs

猜你喜欢

转载自blog.csdn.net/root_miss/article/details/83026022