If you want to send us your comments, please do so. Thanks
More on comments
composer is a Dependency Manager for PHP
This installation is performed on Debian 10.10 Buster
This installs (without git):
Will install 16 packages, and remove 0 packages. 5142 kB of disk space will be used ======================================== [INSTALL, DEPENDENCIES] jsonlint:amd64 1.7.1-1 [INSTALL, DEPENDENCIES] php-composer-ca-bundle:amd64 1.1.4-1 [INSTALL, DEPENDENCIES] php-composer-semver:amd64 1.4.2-1 [INSTALL, DEPENDENCIES] php-composer-spdx-licenses:amd64 1.5.0-1 [INSTALL, DEPENDENCIES] php-composer-xdebug-handler:amd64 1.3.2-1 [INSTALL, DEPENDENCIES] php-json-schema:amd64 5.2.8-1 [INSTALL, DEPENDENCIES] php-mbstring:amd64 2:7.3+69 [INSTALL, DEPENDENCIES] php-psr-log:amd64 1.1.0-1 [INSTALL, DEPENDENCIES] php-symfony-console:amd64 3.4.22+dfsg-2+deb10u1 [INSTALL, DEPENDENCIES] php-symfony-debug:amd64 3.4.22+dfsg-2+deb10u1 [INSTALL, DEPENDENCIES] php-symfony-filesystem:amd64 3.4.22+dfsg-2+deb10u1 [INSTALL, DEPENDENCIES] php-symfony-finder:amd64 3.4.22+dfsg-2+deb10u1 [INSTALL, DEPENDENCIES] php-symfony-process:amd64 3.4.22+dfsg-2+deb10u1 [INSTALL, DEPENDENCIES] php7.3-mbstring:amd64 7.3.29-1~deb10u1 [INSTALL] php-curl:amd64 2:7.3+69 [INSTALL] composer:amd64 1.8.4-1+deb10u1 ========================================
If aptitude installs version 1 it might be needed to upgrade composer to version 2. You can check with
composer --version Composer 1.8.4 2019-02-11 10:52:10
Copy the script from the composer How do I install Composer programmatically page and save it to /home/user/composer-downloader.sh. We made a slightly improved version:
composer-downloader.sh:
#!/bin/bash echo 'Checking if /usr/bin is in $PATH' echo $PATH | grep '/usr/bin' &> /dev/null exitcode=$? if [[ $exitcode -ne 0 ]]; then echo 'ERROR: Check the PATH. /usr/bin should be incorporated' echo "The path is: $PATH" exit 1 fi echo -e '\nGetting composer-setup.php' if [[ -f composer-setup.php ]]; then rm composer-setup.php fi echo 'Get EXPECTED_CHECKSUM' EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" echo 'Calculate ACTUAL_CHECKSUM' ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" echo 'Checking checksums' if [[ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]]; then >&2 echo 'ERROR: Invalid installer checksum' rm composer-setup.php exit 1 fi echo 'Checking and running composer-setup.php' if [[ -f composer-setup.php ]]; then grep '#! /usr/bin/php' composer-setup.php 2>&1 /dev/null exitcode=$? if [[ $exitcode -ne 0 ]]; then # Add "#! /usr/bin/php" on the first line of composer-setup.php sed -i '1 i\#! /usr/bin/php' composer-setup.php fi chmod 740 composer-setup.php # Make sure the script is executable php composer-setup.php --check; # Preform a check echo -e '\nRunning composer-setup' php composer-setup.php; #php composer-setup.php --quiet RESULT=$? #rm composer-setup.php echo Showing the value of RESULT. It should be zero. echo The exit status of composer-setup.sh is: $RESULT. exit $RESULT else echo 'Error: composer-setup.php not found' fi
Do as user
./home/user/composer-downloader.sh
The output should look like (the withe text are our added comments):
All settings correct for using Composer All settings correct for using Composer Downloading... Composer (version 2.1.6) successfully installed to: /home/user/composer.phar Use it: php composer.phar
./composer-setup.php --check;
The output should look like: “All settings correct for using Composer”
As root do:
To see the help page
/usr/local/bin/composer/composer.phar
To self diagnose
/usr/local/bin/composer/composer.phar diagnose
To use composer to install software run
/usr/local/bin/composer/composer.phar require whateverisneededhere
Example
/usr/local/bin/composer/composer.phar require box/spout
Update composer
/usr/local/bin/composer/composer.phar self-update
Update the packages
/usr/local/bin/composer/composer.phar update
Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The json extension is missing. Install it or recompile php without --disable-json
Solution: run: phpenmod json
When running composer-downloader.sh this command in it php -r “composer-setup.php --check;” causes
PHP Parse error: syntax error, unexpected '--' (T_DEC) in Command line code on line 1
Workaround:
When running /usr/local/bin/composer/composer.phar diagnose this error can occur
cURL version: missing, using php streams fallback, which reduces performance
Solution: run aptitude install php-curl
Deprecating composer 1 support
Get composer
Publick keys and checksums
Command line options
Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy
RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2022 Webevaluation.nl and the authors
Changes reserved.