Heroku:有效函数的PHP致命错误 - mb_check_encoding [英] Heroku: PHP Fatal error for valid function - mb_check_encoding

查看:312
本文介绍了Heroku:有效函数的PHP致命错误 - mb_check_encoding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下声明:

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

这适用于我的本地PHP 5.4.17设置和我的共享主机,它具有PHP 5.3.xx



但是当我将这个应用程序部署到Heroku(PHP 5.0.10)时,它在日志中给出了以下错误:



2012-12-26T09:55:28 + 00:00 app [web.1]:[Wed Dec 26 09:55:27 2012] [error] [client 10.119。 79.71] PHP致命错误:在第44行的/app/www/includes/utils.php中调用未定义函数mb_check_encoding(),引用者:https://imagemash.herokuapp.com/



根据 php。 net docs mb_check_encoding 是PHP 5> = 5.1.3的支持。



我做错了什么?或者是我的应用程序以某种方式使用旧版本的PHP?似乎没有任何php.ini值需要设置以启用此功能。

解决方案

感谢DCoder指针和教程在 http://chrismcleod.me / 2011/11/30 / use-custom-php-extensions-on-heroku / ,安装了 https://github.com/wuputah/heroku-libraries



解决了这个问题

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..

解决方案

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

这篇关于Heroku:有效函数的PHP致命错误 - mb_check_encoding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆