Gretta Gretta - 2 years ago 136
PHP Question

Problems with downloading Composer (PHP) on Macbook?

Before I go on, I'm using MAMP(http://www.mamp.info/en/) and I have a Macbook 10.5.8.

I tried typing "curl -sS https://getcomposer.org/installer | php" in my terminal, but all I get is "Parse error: syntax error, unexpected T_SL in - on line 818
curl: (23) Failed writing body".

If I delete the small "s" in "curl -sS", I get:

"% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 32543 0 32543 0 0 25478 0 --:--:-- 0:00:01 --:--:-- 82387

Parse error: syntax error, unexpected T_SL in - on line 818

100 48911 0 48911 0 0 32993 0 --:--:-- 0:00:01 --:--:-- 81518
" but it doesn't do anything.

I even tried to update the path to my PHP thing using this website: "https://gist.github.com/irazasyed/5987693", but my path just stayed the same.

Please help!! :(

Answer Source

Sounds like the installed version of PHP is too old. The error is produced by the PHP interpreter (.. | php). Composer requires PHP 5.3+, I believe OS X 10.5.8 did not come with PHP 5.3 out of the box.

You probably want to use the PHP install bundled with MAMP, so substitute the php executable path at the end of the command. I'm not entirely sure what path that is, but something like:

$ curl ... | /Applications/MAMP/bin/.../php

I don't know why this didn't work with your path update.
To see which PHP the php command resolves to:

$ which php

And last but not least, make sure any of your php versions are 5.3+ to begin with:

$ php -v
$ /Applications/MAMP/bin/.../php -v
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download