2016-10-21 26 views
1

herokugd(またはext-gd)のライブラリをインストールしようとしています。heroku installation gd extension failedに失敗しました

私は作曲を使用してそれらをインストールしよう(次のように私はそれを持っている)

{ 
    "name": "cool/app", 
    "type": "project", 
    "require": { 
     "ext-gd": "dev-master" (tried also installing "gd":"*", "ext-gd" : "*") 
    }, 
    "license": "2016", 
    "authors": [ 
     { 
      "name": "Dario", 
      "email": "[email protected]" 
     } 
    ], 
    "minimum-stability": "dev" 
} 

私は、そう

Problem 1 
- The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension. 

を得たapt-getを(sudo apt-get install php7-gd)からインストールしようとしたが、I私はroot herokuのパスワードを知らないのでsudoの権限は持っていません。

これを回避するには?

EDIT

私がやったより良い説明することが、ここでは全体のコマンドリスト

$ heroku run bash 
Running bash on ⬢ app... up, run.1644 (Free) 
~ $ composer init 


    Welcome to the Composer config generator 



This command will guide you through creating your composer.json config. 

Package name (<vendor>/<name>) [app/app]: 
Description []: 
Author [, n to skip]: n 
Minimum Stability []: 
Package Type (e.g. library, project, metapackage, composer-plugin) []: 
License []: 

Define your dependencies. 

Would you like to define your dependencies (require) interactively [yes]? 
Search for a package: ext-gd 

Found 15 packages matching ext-gd 

    [0] stil/gd-text 
    [1] gd/plesk-bundle 
    [2] quince/persian-gd 
    [3] xepan/gd-text 
    [4] zgldh/gd-text-for-chinese 
    [5] ext-calendar 
    [6] ext-iconv 
    [7] ext-dbus 
    [8] ext-xml 
    [9] ext-opendkim 
    [10] ext-mcrypt 
    [11] ext-openssl 
    [12] ext-ssh2 
    [13] ext-mongo 
    [14] ext-mbstring 

Enter package # to add, or the complete package name if it is not listed: ext-gd 
Enter the version constraint to require (or leave blank to use the latest version): * 
Search for a package: 
Would you like to define your dev dependencies (require-dev) interactively [yes]? no 

{ 
    "name": "u11706/app", 
    "require": { 
     "ext-gd": "*" 
    } 
} 

Do you confirm generation [yes]? 
~ $ composer update 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 

    Problem 1 
    - The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension. 

~ $ composer update --ignore-platform-reqs 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Nothing to install or update 
Writing lock file 
Generating autoload files 

だと私は、PHPとしてgdライブラリを使用することができませんよ(Laravelは)氏は述べていますCall to undefined function App\Http\Controllers\imagecreatefrompng()

ローカルコンピュータからcomposer require ext-gdを実行すると、

Using version ^0.0.0 for ext-gd 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Nothing to install or update 
Writing lock file 
Generating autoload files 

答えて

1

これは実際にはHerokuの問題ではありませんが、ローカルコンピュータでの問題です。

composer updateをローカルで実行しており、composer.lockを再生成しています。 composer.jsonにはext-gdの要件が含まれているため、ローカルコンピュータのPHPインストールにはその拡張機能が有効になっている必要があります。そうしないと要件が満たされず、Composerによってエラーが送出されます。

その正確な状況と回避方法については、https://devcenter.heroku.com/articles/php-support#using-optional-extensionsで説明しています。必要に応じてcomposer update --ignore-platform-reqsを実行するように指示する青色のボックスに注意してください。

+0

ありがとうございますdzuelke。私の質問の変更を参照してください –

+0

最終的には、ヒロクのgitリポジトリをプッシュする前に、ローカルにコンポーザをインストールすることによって問題を解決しました。ありがとうございました –

-1

ローカルでcomposer installで問題を解決してから、gitリポジトリ経由でherokuアプリにデプロイしてください。

0

gdがHerokuで利用可能な場合は、composer.json(requireセクションの下)に次の行を追加して有効にする必要があります。

"ext-gd": "*" 

Herokuのにコードをプッシュする前にローカルでcomposer updateを実行することを確認し、またはそうでなければ動作しません。

関連する問題