Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku: PHP Fatal error for valid function - mb_check_encoding

Tags:

php

heroku

I have the following statement:

$img->setTitle(mb_check_encoding($item['title'], 'UTF-8') ? $item['title'] : utf8_encode($item['title']));

This works on my local setup of PHP 5.4.17 and my shared host which has PHP 5.3.xx

But when I deploy this app to Heroku (which has PHP 5.3.10), it gives the following error in the logs:

2012-12-26T09:55:28+00:00 app[web.1]: [Wed Dec 26 09:55:27 2012] [error] [client 10.119.79.71] PHP Fatal error: Call to undefined function mb_check_encoding() in /app/www/includes/utils.php on line 44, referer: https://imagemash.herokuapp.com/

As per the php.net docs, mb_check_encoding is supported for PHP 5 >= 5.1.3.

What am I doing wrong? Or is my app somehow using an older version of PHP? There does not seem any php.ini value that needs to be set to enable this function as well..

like image 597
AJ. Avatar asked Aug 02 '26 05:08

AJ.


1 Answers

Thanks to AJ.

$ yum install php-mbstring

And perhaps reload the apache:

$ systemctl reload apache2 
like image 154
Roozbeh Zabihollahi Avatar answered Aug 03 '26 22:08

Roozbeh Zabihollahi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!