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..
Advertisement
Answer
Thanks to DCoder’s pointer and the tutorial at http://chrismcleod.me/2011/11/30/use-custom-php-extensions-on-heroku/, installed the mbstring.so extension available at https://github.com/wuputah/heroku-libraries
This solved the problem