Urania

A blog named for the muse of Astronomy containing musings by an astronomer

These Fork()ing PHP Woes continue

Posted on August 18, 2008 by Juan
What do you know, one reboot later and MacPorts Apache2 server with MacPorts PHP is throwing the same errors as the built-in PHP server. When I try to create a graphic using typography, I get
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.
It wasn’t complaining before the reboot. Maybe Apple’s security kicked in after the reboot although for the life of me I can’t understand why. I’ve continued investigating and in Apple’s Discussion boards I found there was a string of comments about this problem. One user, Bill Eccles, seemed to isolate the problem and his description matches the symptoms I am seeing:
Finally, there’s a big problem with FreeType. As I discovered, anytime FreeType fonts are used by GD, they apparently make a Carbon API call of some sort. Problem is, Apache2 uses fork() without a corresponding exec() and, upon calling PHP/GD/FreeType, the Carbon call in FreeType causes Apache2 to crash. It shows up in the error_log as
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.
Mon Nov 26 12:38:11 2007 notice child pid 304 exit signal Trace/BPT trap (5)
and in the system.log as
Nov 26 13:12:00 shr-g5 ReportCrash664: Formulating crash report for process httpd659
Nov 26 13:12:02 shr-g5 ReportCrash664: Saved crashreport to /Library/Logs/CrashReporter/httpd_2007-11-26-131145_shr-g5.crash using uid: 0 gid: 0, euid: 0 egid: 0
I didn’t discover the cause–I can’t take credit for this one.
At this point he provides a link to a blog that was just reposting mailing list digests and as such got pulled down. I think I have found the original thread about the problem on the FreeType mailing lists here. Bill then suggests the following solution (this is not complete):
[I]nstall FreeType 2 without the Mac-specific extensions. These extensions make it possible for FT2 to access fonts stored in a font suitcase, something which is unnecessary if you use plain “.ttf” fonts from other sources. Here’s how I did that: Get FT2 and expand the tarball: (in Sources–my version of /SourceCache):
curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
cd ..
tar xvfp Sources/freetype-2.3.5.tar.gz
Configure FT2 and make it:
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-fsspec=no --with-fsref=no --with-quickdraw-toolbox=no --with-quickdraw-carbon=no
make
sudo make install
Libraries end up in /usr/local/lib.
The funny thing is I have FreeType 2.3.7 courtesy of MacPorts, so I don’t know why the MacPorts installation of PHP is throwing the error unless it is not accessing the MacPorts version of GD. Actually, it makes complete sense. FreeType 2.3.7 in MacPorts is compiled with old font support (which is what triggers the problem). I submitted a trouble ticket requesting a variant of freetype be made available to disable old font support (which won’t work in Leopard anyway).

2 Trackbacks/Pingbacks

  1. 18 08 08 11:31

    Urania » Blog Archive » Fixing my PHP woes with MacPorts

  2. 05 09 08 12:45

    Urania » Blog Archive » Fork()ing Problems with FreeType solved


Leave a Reply


  • Translate

  • Astro Pic o' the Day

  • Archives

  • Admin



↑ Top