安装 Composer 失败。无法访问 http://

安装 Composer 失败。无法访问 http://

我正在尝试使用以下命令安装 Composer:

curl -s https://getcomposer.org/installer | php

我收到了这个错误:

PHP Warning:  Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
#!/usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

Your PHP (5.3.2-1ubuntu4.18) is quite old, upgrading to PHP 5.3.4 or higher is recommended.
Composer works with 5.3.2+ for most people, but there might be edge case issues.

Downloading...
Download failed: Unable to access https://getcomposer.org/composer.phar
Downloading...
Download failed: Unable to access https://getcomposer.org/composer.phar
Downloading...
Download failed: Unable to access https://getcomposer.org/composer.phar
The download failed repeatedly, aborting.

任何想法?

答案1

我刚刚在我的电脑上尝试过:

[alexus@wcmisdlin02 ~]$ curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended.
Composer works with 5.3.2+ for most people, but there might be edge case issues.

Downloading...

Composer successfully installed to: /home/alexus/composer.phar
Use it: php composer.phar
[alexus@wcmisdlin02 ~]$ php -v
PHP 5.3.3 (cli) (built: Jun 27 2012 14:13:03) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[alexus@wcmisdlin02 ~]$ 

首先尝试更新您的 PHP 包,然后再试一次。

似乎你这边缺少一些 php 扩展,下面是我在我的这边安装的:

[alexus@wcmisdlin02 ~]$ rpm -qa | grep ^php
php-mysql-5.3.3-14.el6_3.x86_64
php-pear-1.9.4-4.el6.noarch
php-pecl-xhprof-0.9.2-5.el6.x86_64
php-gd-5.3.3-14.el6_3.x86_64
php-pear-Console-Color-1.0.3-1.el6.noarch
php-mbstring-5.3.3-14.el6_3.x86_64
php-pdo-5.3.3-14.el6_3.x86_64
php-common-5.3.3-14.el6_3.x86_64
php-soap-5.3.3-14.el6_3.x86_64
phpMyAdmin-3.5.4-1.el6.noarch
php-php-gettext-1.0.11-3.el6.noarch
php-xml-5.3.3-14.el6_3.x86_64
php-pecl-apc-3.1.9-2.el6.x86_64
php-pear-Console-Table-1.1.4-1.el6.2.noarch
php-mcrypt-5.3.3-1.el6.x86_64
php-cli-5.3.3-14.el6_3.x86_64
php-5.3.3-14.el6_3.x86_64
[alexus@wcmisdlin02 ~]$ 

答案2

已解决:禁用 safe_mode 就可以了!

相关内容