I have SSH access to my 1and1 server. I am trying to download composer.
Following instructions from http://getcomposer.org/download/
Attempt 1:
user:~ > curl -sS https://getcomposer.org/installer | php
X-Powered-By: PHP/4.4.9
Content-type: text/html
<br />
<b>Parse error</b>: syntax error, unexpected '{' in <b>-</b> on line <b>316</b><br />
Attempt 2:
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-b <address:port>|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
Am I doing something obviously wrong?
I know that it is saying that I am running php 4.4.9, but if I run phpinfo(), it says PHP Version 5.4.21
is running. Any suggestions on what is going on here?
phpinfo()
php -v
yes, but it's not necessary to download vendors with composer install . you can move composer binary file to Server and move your vendor too, then place vendor folder on your project and use composer dump-autoload .
You can check your installed composer version using a command composer -v at the current path. Such as: composer -v.
Currently 1&1 offers a bunch of PHP versions under different aliases.
However the easiest way to set a default PHP version to use is from your 1&1 dashboard PHP settings and set it per domain individually. This is located under Hosting and then PHP settings. [1&1 PHP Settings (United States site)]
Note that 1and1 updates the PHP versions now quite regularly and also the CLI version may differ to the one user to render your site.
Original answer. It's been a long time, I recommend using the the latest 7.x.
There actually are 4 versions of php preinstalled on all the 1and1 linux shared hosting.
Command:
php
: Version 4.4 (The one you're actually using with composer.)php5
: Version 5.2php5.5
: Version 5.5php6
: Version 5.4You have to invoke composer using php5.5 and it will just work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With