zoukankan      html  css  js  c++  java
  • Linux 系统 Composer 安装

    Composer 是个包管理工具

    在项目中使用它会很方便

    本文中用 PHP 安装

    1、下载安装

    执行命令 curl -sS https://getcomposer.org/installer | php

    2、配置环境变量

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

    3、设置国内镜像

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

    4、遇到的问题

    Q1:/usr/bin/env: php: No such file or directory
    A1:找不到 php 执行文件,cp /usr/local/php/bin/php /usr/local/bin/php

    Q2:执行 composer 抛出 Killed
    A2:缓存不足导致,linux 增加缓存
    free -m
    mkdir -p /var/_swap_
    cd /var/_swap_
    dd if=/dev/zero of=swapfile bs=1M count=2000
    mkswap swapfile
    swapon swapfile
    echo “/var/_swap_/swapfile none swap sw 0 0” >> /etc/fstab
    free -m


    Q3:
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.

    Problem 1
    - league/flysystem 1.0.53 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - league/flysystem 1.0.53 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - league/flysystem 1.0.53 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for league/flysystem (locked at 1.0.53) -> satisfiable by league/flysystem[1.0.53].

    To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/php/lib/php.ini
    You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

    Installation failed, reverting ./composer.json to its original content.

    A3:安装 fileinfo 扩展包
    cd /usr/local/src/php-7.3.4/ext/fileinfo/
    /usr/local/php/bin/phpize
    ./configure --with-php-config=/usr/local/php/bin/php-config

  • 相关阅读:
    [ 9.10 ]CF每日一题系列—— 186A模拟处理字符串
    python查看删除你微信的账号
    python进阶之路4.2---装饰器
    python进阶之路4.1---生成器与迭代器
    Python进阶之路---1.4python数据类型-数字
    Python进阶之路---1.3python环境搭建
    Python进阶之路---1.2python版本差异
    Python进阶之路---1.1python简介
    麦进斗Magento2 SEO默认设置的完整策划
    如何修改Magento主题中的toplinks
  • 原文地址:https://www.cnblogs.com/rendd/p/11718539.html
Copyright © 2011-2022 走看看