I had the same error. I ended up adding sudo to the php side and it worked for me.
curl -sS https://getcomposer.org/installer | sudo php
I had the same error. I ended up adding sudo to the php side and it worked for me.
curl -sS https://getcomposer.org/installer | sudo php