Calls to imagettftext cause fatal error in php
Chris Janton
face at CentosPrime.COM
Sun Jul 6 06:16:51 PDT 2008
On 2008-07-05 , at 23:56 , Bill Hernandez wrote:
> I posted a bug report:
> http://bugs.php.net/bug.php?id=45437
> Bug #45437 Calls to imagettftext crash
>
> Same exact problem has been reported as Bug #44524, but has been
> written off as bogus.
> IT IS NOT BOGUS...
> Problem:
> ------------
> Calls to imagettftext always fail with no error on Leopard 10.5.3
> when run under MacPorts Apache 2.2.6, PHP 5.2.5 and the GD library.
> Reproduce code:
I can see why they claim it is bogus.
PHP (5.2.6) produces the image just fine...
face at mac:Sites:133 $ which php
/opt/local/bin/php
face at mac:Sites:134 $ php --version
PHP 5.2.6 (cli) (built: May 25 2008 13:28:23)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
face at mac:Sites:135 $ php foo.php >zippy.png
face at mac:Sites:136 $ ls -al zippy.png
-rw-r--r-- 1 face staff 892B Jul 6 05:33 zippy.png
face at mac:Sites:137 $ open zippy.png
Preview happily shows me the image.
I suspect the PHP folks will tell you that this is a problem with
Apache, or the way that you have built Apache.
Note that I can run this example just fine with Apache 1.3.
Further investigation points to this page
http://90kts.com/blog/2008/installing-gd-libraries-for-leopard-apache-php-525/
where you will find bits and pieces like...
"i have the same problem with ttf fonts… can someone help? this says
the log file:
The process has forked and you cannot use this CoreFoundation
functionality safely. You MUST exec().
Break on
__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__
() to debug."
and
"I think the reason is posted here:
http://developer.apple.com/releasenotes/CoreFoundation/CoreFoundation.html
CoreFoundation and fork()
Due to the behavior of fork(), CoreFoundation cannot be used on the
child-side of fork(). If you fork(), you must follow that with an
exec*() call of some sort, and you should not use CoreFoundation APIs
within the child, before the exec*(). The applies to all higher-level
APIs which use CoreFoundation, and since you cannot know what those
higher-level APIs are doing, and whether they are using CoreFoundation
APIs, you should not use any higher-level APIs either. This includes
use of the daemon() function."
SO - it boils down to getting the maintainer of freetype (Maintainers: ryandesign at macports.org
) to look at the implications of the following configuration options
--with-quickdraw-toolbox
use MacOS QuickDraw in ToolBox, if available
(default=yes)
--with-quickdraw-carbon use MacOS QuickDraw in Carbon, if available
(default=yes)
and if they should be changed, or a variant made available for Leopard
users.
Clear as mud?
8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
More information about the macports-users
mailing list