4

I can't install gettext extension on Heroku plataform. On development enviroment gettext works, but not on Heroku.

My struture:

/app
    /web
        .user.ini
        gettext.php
        index.php
    composer.json
    composer.lock
    Procfile
    README.md

.user.ini

extension = gettext.so

composer.json:

{
   "require": {
      "php": "~5.6.4",
      "slim/slim": "~2.6",
      "nategood/httpful": "*",
      "gettext": "*"
    },
    "require-dev": {
      "heroku/heroku-buildpack-php": "*"
   }
}

And the code gettext.php:

if (!function_exists("gettext")){ echo "gettext is not installed\n";}
else{echo "gettext is supported\n";}

Return:

gettext is not installed

And when I try heroku run bash and after composer update:

Problem 1
   - The requested PHP extension ext-gettext * is missing from your system.
Jessé Pinheiro
  • 303
  • 1
  • 3
  • 10

1 Answers1

7

Firstly you need to use the ext- prefix to apply extensions.

{
   "require": {
      "ext-gettext": "*"
    },
    "require-dev": {
      "heroku/heroku-buildpack-php": "*"
   }
}

Run composer update

If you still get error it means composer cannot update your vendor files for gettext. I had same issue and think it's a composer problem.

For true parity you should try and obtain the the lib required but you could just ignore the lack of a local gettext with:

composer update --ignore-platform-reqs

Composer will then run without error and you can then push that up to Heroku. Heroku will then build PHP with gettext enabled.

Steve Royall
  • 192
  • 1
  • 1
  • 8