Question

How can i enable mbstring within a PHP app?

I am trying to run a PHP 7+ app but can’t get mbstring extension enabled.


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
August 6, 2022

Hello @tarekahmed,

Yes, you can do that by specifying the additional extensions in your composer.json file like this:

  1. "require": {
  2. "ext-mbstring": "*"
  3. }

If you want to add into just add it bellow mbstring

"ext-intl": "*",

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
August 5, 2022

Hi @tarekahmed,

I’ll recommend checking out the following tutorial on the matter:

https://docs.digitalocean.com/products/app-platform/reference/buildpacks/php/

It says how you can add different extensions.

Additionally, here is a similar question that was asked some time back and has been answered:

https://www.digitalocean.com/community/questions/install-enable-php-intl-extension-in-app-platform

I think, you’ll find that interesting as well. Basically, to install the php mbstring you would need to use Composer with your app to specify that version.

Something like this should work:

{ “require”: { “ext-mbstring”: “*” } }