3

Does anybody know how to install the PHP Extension: Multibyte String for Heroku: http://php.net/manual/en/book.mbstring.php

Here is how I installed Mongo for Heroku:

https://gist.github.com/1288447

All is well, but I cannot find the source for compiling the mbstring.so file.

Any guidance would be most appreciated.

Pabluez
  • 2,653
  • 3
  • 19
  • 29
Keg Powder
  • 41
  • 1
  • 3
  • source for mbstrings are in php distribution. after that all is very easy. phpize, ./configure, make, download .so from modules folder and add to extensions dir and add to php ini. works file. – Keg Powder Dec 29 '11 at 13:50

3 Answers3

5

The preferred way of getting extensions for Heroku would be to use composer.json. mbstring is one of the extensions that Heroku provides pre-compiled and shared according to https://devcenter.heroku.com/articles/php-support#extensions

To use it, all you have to do is create a composer.json file (if you don't already have one) in the root of your project with the following contents:

{
    "require": { 
        "ext-mbstring": "*"
    }
}

There is no need to compile your own mbstring extension or grab a compiled version from somewhere else.

As a side note, there's also no longer a need to compile the MongoDB extension yourself, either. It's also on the list of Heroku-provided extensions and you could have a composer.json file do both, like this:

{
    "require": { 
        "ext-mbstring": "*",
        "ext-mongo": "*"
    }
}
timginn
  • 71
  • 1
  • 6
  • 1
    Yes, it is really as simple as that ! And do not forget to run composer update... – mika Nov 06 '15 at 13:20
0

I compiled mbstring.so on Heroku. it works fine. http://en.blog.candycane.jp/2012/04/11/running-php-on-heroku-with-mbstring/

Yusuke Ando
  • 121
  • 1
  • 5
0

if you download from https://github.com/wuputah/heroku-libraries/raw/master/php/mongo/mongo.so the file mongo.so is gonna be already compiled. You will need only go to php.ini and set extension_dir = "dir where you put mongo.so" and extension=mongo.so.

You can ensure that it is compiled using:

$ file mongo.so
mongo.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

What i'm not sure is if this binary is suitable for linux... try to check this out.

Pabluez
  • 2,653
  • 3
  • 19
  • 29