Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax errors when installing Composer?

I have tried to start installing composer using each of these

sudo -u myuser curl -sS https://getcomposer.org/installer | php

sudo -u myuser curl -s https://getcomposer.org/installer | php -- --check

But both give me

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in - on line 381

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in - on line 386

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in - on line 402

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in - on line 640

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in - on line 688

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

Anyone seen this before?

I'm running Linux 3.1.9-vs2.3.2.5vs2.3.2.5+ and PHP 5.2.17 (cli)

like image 969
jerrygarciuh Avatar asked Apr 09 '14 01:04

jerrygarciuh


1 Answers

You are using a php command line version that does not understand namespaces: 5.2.17. Composer can only run with PHP 5.3 and up.

Note that that version you run on the command line need not have anything to do with the PHP you are using in the web server itself. It usually is a different executable with it's own configuration.

like image 176
Sven Avatar answered Sep 21 '22 19:09

Sven