Sample Header Ad - 728x90

Installing Composer on CentOS with multiple PHP versions

0 votes
2 answers
2148 views
I have multiple versions of PHP (5.6 and 7.2) installed on my CentOS 7 server. Googling CentOS 7 Composer installation seems to have the same guide, just under a different blog with these steps: $ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer $ chmod +x /usr/local/bin/composer $ composer -V Composer version 1.5.2 2017-09-11 16:59:25 However, this threw an error straight away. So I changed this command: $ curl -sS https://getcomposer.org/installer | php to: $ curl -sS https://getcomposer.org/installer | php72 This now downloaded the file, however when I tried using composer -V (after the other steps) it throws this error: > /usr/bin/env: php: No such file or directory So I vim'd into /usr/local/bin/composer to see the line right at the top: #!/usr/bin/env php I changed that to #!/usr/bin/env php72 but doing composer -V now shows: PHP Fatal error: Uncaught PharException: phar "/usr/local/bin/composer" has a broken signature in /usr/local/bin/composer:23 Stack trace: #0 /usr/local/bin/composer(23): Phar::mapPhar('composer.phar') #1 {main} thrown in /usr/local/bin/composer on line 23 I tried the same with php56 to the same result. How do I go about installing composer correctly on a CentOS 7 server running multiple versions of PHP? Sidenote: lemme know if this is better for say ... superuser
Asked by treyBake (389 rep)
Apr 10, 2019, 08:52 AM
Last activity: Jun 8, 2025, 11:04 AM