简体   繁体   中英

How to install GD on Heroku

I am running Laravel 5.3 and trying to do some image manipulation. I get this error: GD Library extension not available with this PHP installation.

I've tried putting gd in my composer.json

"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.3.*",
    "mews/purifier": "~2.0",
    "vinkla/hashids": "^2.4",
    "barryvdh/laravel-debugbar": "^2.2",
    "fzaninotto/faker": "~1.4",
    "intervention/image": "^2.3",
    "gd": "*"
},

and it didn't work. I also tried:

"ext-gd": "*" 

and that didn't work either. I looked at this page https://devcenter.heroku.com/articles/php-support and it says:

The following built-in extensions have been built “shared” and can be enabled through composer.json (internal identifier names given in parentheses)

GD (gd)

Add "gd": "*" to composer.json and perform composer update

If that doesn't work add "ext-gd":" *" and do a composer update

I run composer require ext-gd and git push heroku master it did work.

I tried add "gd": "*" to composer.json and perform composer update but when push to Heroku meet error with Class 'Symfony\\Component\\HttpFoundation\\InputBag' not found . I think it's not only update ext-gd with composer update

In composer.json file

"require": {
        "facade/ignition": "^2.3.6",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3",
        "ext-gd": "*"

    },

Update composer and push to origin branch

composer update

git add .

git commit -m "message"

git push origin <branch name>

Rebuild your project at Heroku

https://devcenter.heroku.com/articles/php-support#extensions

I did the same instructions but I have this problem after i run composer update on heroku.

Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires PHP extension ext-gd * but it is missing from your system. Install or enable PHP's gd extension.

To enable extensions, verify that they are enabled in your.ini files:

 - /app/.heroku/php/etc/php/php-cli.ini
 - /app/.heroku/php/etc/php/conf.d/000-heroku.ini
 - /app/.heroku/php/etc/php/conf.d/010-ext-zend_opcache.ini
 - /app/.heroku/php/etc/php/conf.d/100-ext-mbstring.ini

You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.

Alternatively, you can run Composer with --ignore-platform-req=ext-gd to temporarily ignore these required extensions.

muchas gracias, me funcion modificar en composer.json ingresando "ext-gd":"*"

"require": { "facade/ignition": "^2.3.6", "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^5.0", "phpunit/phpunit": "^9.3", "ext-gd": "*"

},

luego actualice composer con el comando de abajo y segui los pasos y funciono todo ok

composer update

git add.

git commit -m "message"

git push origin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM