zoukankan      html  css  js  c++  java
  • php——composer安装与使用

    Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

    下载安装器

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

    校验

    php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

    本地工程安装

    php composer-setup.php --install-dir=bin --filename=composer
    All settings correct for using Composer
    Downloading...
    Composer (version 2.2.3) successfully installed to: ../bin/composer
    Use it: php bin/composer
    
    localhost:vms chong$ php bin/composer --version
    Composer version 2.2.3 2021-12-31 12:18:53

    全局安装

    php composer-setup.php
    
    sudo mv composer.phar /usr/local/bin/composer

    常见异常处理

    1、preg_replace(): Allocation of JIT memory failed

    php bin/composer update
                                                                                                            
      [ErrorException]                                                                                      
      preg_replace(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by  
       security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0  
                                                                                                            
    
    install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest]
    [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
    [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX]
    [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>]...

    解决办法

    /Applications/XAMPP/xamppfiles/etc/php.ini

    修改php.ini:


    ;pcre.jit=1
    改为:
    pcre.jit=0

    保存,重启php服务即可

  • 相关阅读:
    H5页面富文本展示图片之间存在空隙
    如何关闭eslint语法校验
    K8S service详解
    vim添加或删除多行注释
    K8S 弹性伸缩
    Load高问题排查
    Dockerfile CMD和ENTRYPOINT
    nginx配置
    sed命令
    Pod排错指南
  • 原文地址:https://www.cnblogs.com/xingchong/p/15766445.html
Copyright © 2011-2022 走看看