Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Composer for Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to install Composer in Linux, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Getting started with Linux installation Composer

Practice environment:

Virtual machine: Oracle VM VirtualBox.

System: CentOS 7.

Installation method 1: refer to the website: https://learnku.com/composer/t/4484/composer-mirror-use-help#741738 to install. 1. Download: wget https://dl.laravel-china.org/composer.phar-O / usr/local/bin/composer 2, modify permission: chmod afigx / usr/local/bin/composer 3, view version: composer-V installation method 2: refer to the website: https://pkg.phpcomposer.com/ to install. 1. Download the installation script: php-r "copy ('https://install.phpcomposer.com/installer',' composer-setup.php'); 2. Perform the installation process: php composer-setup.php 3. Delete the installation script: php-r" unlink ('composer-setup.php') "4. Install Composer to the path contained in the system environment variable PATH: sudo mv composer.phar / usr/local/bin/composer 5, update Composer:composer selfupdate installation method 3: refer to the website: https://getcomposer.org/download/ to install. Php-r-r-- there are two options for using Composer image acceleration: option 1: global configuration so that all projects can benefit (recommended); option 2: individual project configuration Option 1. Global configuration (recommended) composer config-g repo.packagist composer https://packagist.laravel-china.org option 2. Use alone. If the image is only used in the current project, remove-g, as follows: composer config repo.packagist composer https://packagist.laravel-china.org unmirroring composer config-g-unset repos.packagist may encounter errors:

(1)

Error: there is no matching certificate principal alias (Subject Alternative Name).

The requested hostname is "dl.laravel-china.org".

To connect to the dl.laravel-china.org in an unsecure manner, use "--no-check-certificate".

Solution: according to the prompt in the error, add-- no-check-certificate

Wget-- no-check-certificate https://dl.laravel-china.org/composer.phar-Oc / usr/local/bin/composer

(2)

Failed to decode zlib stream

Solution: PHP script does not have write permission, add write permission to the script, chmod aquix composer-setup.php.

(3)

Composer: line 1: syntax error near unexpected symbol `newline'

Solution: download the file, there may be a problem, you can try to download again, or find another download source to download.

(4)

Failed to open stream: HTTP request failed!

Solution: when downloading files using php, report this error, modify php.ini, and remove the comments before setting allow_url_fopen to on,user_agent= "PHP"

If there are any more errors, set user_agent= "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" to try.

(5) if you still report an error and there is no way to solve it, download it directly with windows, pass it to the virtual machine in the form of ftp or shared files, and then use it directly.

The above is all the contents of the article "how to install Composer in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report