I am trying to deploy an application that works fine on PHP-FPM to HHVM. Nearly everything works except for one thing: the GD Library. GD in general works, but imagettftext()
and imagefttext()
don't seem to be working.
They return this confusing error:
[ErrorException]
No such file or directory
I already recompiled HHVM, to include the FreeType path and gd_info()
{"GD Version":"bundled (2.0.34 compatible)","FreeType Support":true,"FreeType Linkage":"with freetype","T1Lib_Support":false,"GIF Read Support":true,"GIF Create Support":true,"JPEG Support":true,"PNG Support":true,"WBMP Support":true,"XPM Support":false,"XBM Support":true,"JIS-mapped Japanese Font Support":false}
I tried this (https://stackoverflow.com/a/15001557/1792799) solution, but to no avail.
I am pretty sure that this error has nothing to do with the code, as it works perfectly fine on 'normal' PHP. But here's the part where it goes wrong anyway. The font path exists and is readable by the server, the font file exists and again the same code on the same server runs fine with PHP-FPM.
// Font path
putenv('GDFONTPATH=' . $basepath . '/' . 'font');
// Choose font
$mc = "mc";
// Set font-sizes
$fonts = 12;
$mfont = 12 - 2.2;
$snx = 15;
$sny = 21;
$mx = $snx;
$my = $sny + 16;
$sipx = $snx;
$sipy = $my + 15;
$motd = $server->getCache('motd');
$motd = (strlen($motd) > 43) ? substr($motd, 0, 40).'...' : $motd;
// Server name
imagettftext($image, $fonts, 0, $snx + 1, $sny + 1, $white_shadow, $mc, $server->name);
imagettftext($image, $fonts, 0, $snx, $sny, $white, $mc, $server->name);
Thanks in advance!