在Macbook上下载Composer(PHP)有问题吗? [英] Problems with downloading Composer (PHP) on Macbook?

查看:72
本文介绍了在Macbook上下载Composer(PHP)有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在继续之前,我正在使用MAMP( http://www.mamp.info/zh-CN /),我有一台Macbook 10.5.8.

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

我尝试在终端中键入curl -sS https://getcomposer.org/installer | php,但我得到的只是

I tried typing curl -sS https://getcomposer.org/installer | php in my terminal, but all I get is

解析错误:语法错误,第818行中的-意外T_SL curl:(23)书写体失败.

Parse error: syntax error, unexpected T_SL in - on line 818 curl: (23) Failed writing body.

如果我删除curl -sS中的小"s",则会得到:

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

解析错误:语法错误,在第818行的-中出现意外的T_SL

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

100 48911    0 48911    0     0  32993      0 --:--:--  0:00:01 --:--:-- 81518

但是它什么也没做.

我什至尝试使用此网站来更新我的PHP东西的路径:" https://gist .github.com/irazasyed/5987693 ",但我的路径保持不变.

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.

为什么会发生该错误,以及如何避免该错误?

Why is the error happening and how can it be avoided?

推荐答案

听起来像已安装的PHP版本太旧.该错误是由PHP解释器(.. | php)产生的. Composer需要PHP 5.3+,我相信OS X 10.5.8并非随PHP 5.3一起提供.

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.

您可能要使用与MAMP捆绑在一起的PHP安装,因此请在命令末尾替换php可执行文件路径.我不完全确定这是什么路径,但是类似:

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

我不知道为什么这与您的路径更新不兼容.
要查看php命令解析为哪个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

最后但并非最不重要的一点,请确保您的任何php版本都以5.3+开始:

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

这篇关于在Macbook上下载Composer(PHP)有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆