I had the same error. This is how I solved the problem.I followed the instructions in https://getcomposer.org/download/, paragraph below Command-line installation
```php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"php composer-setup.phpphp -r "unlink('composer-setup.php');"```
I replaced line php composer-setup.php
by php composer-setup.php --disable-tls
No need to edit the php script.
I got the idea from reviewing the code in composer-setup.php where I found the option. I should have ran php composer-setup.php --help
to find the same answer faster and without reading code.