我在PHP 5.6中尝试生成文本时收到错误'imagettfbbox()无法找到我可以处理的CharMap'

I've been trying to use the following PHP code to generate a imagettfbbox:

$font_path = "/var/www/lib/fonts/Arial.ttf";

$rect = imagettfbbox(10,0,$font_path,"Hello world!");

However each time I try I get the following error:

Warning (2): imagettfbbox() [function.imagettfbbox]: Unable to find a CharMap that I can handle

I have both FreeType and GD support as confirmed with phpinfo(). I can't find any documentation indicating what might be causing this problem and this code works fine on an earlier version of PHP. Am I missing something else?