Skip to Main Content

Use Carbon Fields on Cloudways

I recently attempted to use Carbon Fields to generate custom metaboxes for a site hosted on Cloudways with PHP 7. I discovered, much to my dismay, that cloudways doesn’t support some of the multi-byte string functions in PHP (namely mb_strtolower) which is required for Carbon Fields.

For the benefit of those googling for answers, the site shows a blank white screen, and the error log contains PHP Fatal error: Uncaught Error: Call to undefined function Carbon_Fields\\Field\\mb_strtolower()


I’ve had no luck so far working with the CloudWays support team, but I will update this post if I hear back from their tier 3 technicians. I also reached out to HTMLburger, the makers of Carbon  Fields, to see if they can implement a workaround internally.

In the mean time, I was able to get the plugin running by importing the mb_string shim class from Patchwork Framework, by Nicolas Grekas. I’ve included a modified single file version of the shim with support checking added for each function, that you can import into your project to get Carbon Fields working, until Cloudways resolves the problem properly.

This is not a perfect replacement, as it is UTF-8 centric, so may behave unexpectedly with other character encodings, but it will at least get you up and running. Please, Cloudways, fix this.

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>