无法通过 ssh 访问服务器下载 composer - 1and1
我可以通过 SSH 访问我的 1and1 服务器.我正在尝试下载作曲家.
按照 ]
请注意,现在 1and1 会定期更新 PHP 版本,而且 CLI 版本可能与呈现您网站的用户不同.
原答案.久违了,推荐使用最新的7.x.
实际上所有1and1 linux共享主机上都预装了4个版本的php.
命令:
php
:4.4 版(您实际与 composer 一起使用的那个.)php5
:版本 5.2php5.5
:5.5版php6
:5.4 版
您必须使用 php5.5 调用 composer,它才可以工作.
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
解决方案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.4
You have to invoke composer using php5.5 and it will just work.
相关文章