LoginSignup
12
16

More than 5 years have passed since last update.

CentOS6.7にてPEARのライブラリをComposerでインストールしようとしたらはまった

Last updated at Posted at 2016-03-15

はまった

composer.json
{
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net/"
        }
    ],
    "require": {
        "pear-pear.php.net/PEAR" : "*",
        "pear-pear.php.net/HTTP_Request2": "*"
    }
}
$ php composer.phar install
Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
PEAR repository from http://pear.php.net could not be loaded. Your configuration does not allow connection to http://http://pear.php.net. See https://getcomposer.org/doc/06-config.md#secure-http for details.
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package pear-pear.php.net/mail_mime could not be found in any version, there may be a typo in the package name.
  Problem 2
    - The requested package pear-pear.php.net/http_request2 could not be found in any version, there may be a typo in the package name.
  Problem 3
    - The requested package pear-pear.php.net/mail_mimedecode could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

エラーがでる。
Mac OS Xのbrewで入れたcomposerだとうまく行くのに、CentOS6.7だとうまく行かない。

修正

httpじゃないとダメだよ、ということだったのでsecure-httpオプションをオフに

composer.json
{
    "config": {
        "secure-http": false
    },
    "repositories": [
        {
            "type": "pear",
            "url": "https://pear.php.net/"
        }
    ],
    "require": {
        "pear-pear.php.net/PEAR" : "*",
        "pear-pear.php.net/http_request2": "*"
    }
}
$ php composer.phar install

うまく行きました。composerのバージョンかと思います。

その他

他のオープンソースなプロジェクトのcomposer.jsonで同様の
Your configuration does not allow connection to
と言われてしまいました。
公開されているcomposer.jsonにはsecure-httpの記載がありません。

改めてググってみたところ、グローバル環境変数?でこのオプションをオフにするコマンドがありました。

composer config -g -- disable-tls false

http://stackoverflow.com/questions/36003429/latest-composer-version-not-pulling-laravel

上記のコマンドでホームディレクトリにある設定ファイルの内容が書き換わるようです。

~/.composer/config.json
{
    "config": {
        "disable-tls": false
}

他のプロジェクトですがこれで解決しました。恐らく表題の件もこれで解決できると思われます。

12
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
16