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

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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!

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”: “*” } }