Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install gettext extension for php on Heroku?

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.
like image 587
Jessé Pinheiro Avatar asked Mar 14 '23 22:03

Jessé Pinheiro


1 Answers

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.

like image 107
Steve Royall Avatar answered Mar 23 '23 20:03

Steve Royall