MacMini Landscape Server, Part II

 So apparently php5 out of the Leopard box does not have GD or freetype support turned on. Tried a quickie rebuild of the gd.so dynamic loadlib for preinstalled PHP, but got all sorts of undefined errors when invoked.

 

So Mike says, get fink and install fresh packages. Well, fink for 10.5 didn’t exist a few days ago. PHP5 is in the "unstable" brach of distributions, building libraries from fink didn’t always look back to see what other libraries were already installed (e.g., fink install pnglib2 followed by fink install gd2 , gd2 continued to look for pnglib in /usr/X11 ).

 

So I went back to good old install from source into /usr/local. configured, maked, and installed libjpge-6, libpng, libfreetype, libgd. Then looked at the phpinfo for sample config for php. Saw something like this

 

/SourceCache/apache_mod_php/apache_mod_php-44/php/configure’ ‘–prefix=/usr’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–disable-dependency-tracking’ ‘–with-apxs2=/usr/sbin/apxs’ ‘–with-ldap=/usr’ ‘–with-kerberos=/usr’ ‘–enable-cli’ ‘–with-zlib-dir=/usr’ ‘–enable-trans-sid’ ‘–with-xml’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-mbstring’ ‘–enable-mbregex’ ‘–enable-dbx’ ‘–enable-sockets’ ‘–with-iodbc=/usr’ ‘–with-curl=/usr’ ‘–with-config-file-path=/etc’ ‘–sysconfdir=/private/etc’ ‘–with-mysql-sock=/var/mysql’ ‘–with-mysqli=/usr/bin/mysql_config’ ‘–with-mysql=/usr’ ‘–with-openssl’ ‘–with-xmlrpc’ ‘–with-xsl=/usr’ ‘–without-pear’

Wanted to be sure we had all the right compiler flags for universal builds. See http://developer.apple.com/technotes/tn2005/tn2137.html so we add

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" 

 

and I want to enable built-in true type font support, so I add –enable-gd-native-ttf

yielding

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 –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –disable-dependency-tracking –with-apxs2=/usr/sbin/apxs –with-ldap=/usr –with-kerberos=/usr –enable-cli –with-zlib-dir=/usr –enable-trans-sid –with-xml –enable-exif –enable-ftp –enable-mbstring –enable-mbregex –enable-dbx –enable-sockets –enable-gd-native-ttf –with-iodbc=/usr –with-curl=/usr –with-config-file-path=/etc –sysconfdir=/private/etc –with-mysql-sock=/var/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql=/usr/local/mysql –with-openssl –with-xmlrpc –with-xsl=/usr –without-pear

But when it became time to compile, it failed, because the libmysql installed from the Package didn’t include the right architectures. (just i386).

 

Tried again, reducing choices down to just i386. Resultant php5.so now fails when apache loads it, again a bad architectures problem

So, now we download mysql source and recompile (with all the flags), and the try php build again.

 

This time it almost worked, but no php was looking for libmysql in /usr/local/mysql/lib/mysql , thanks to an errant –prefix= somwehere. Rather than fix it right, I just made an alias. PHP and APACHE started!

But the graphs and such still fail.

Turns out, I missed these two important points

  1. Using modified php.ini file that forced load og a gd.so built (incorrectly) days ago, and so newly compiled GD support was ignored
  2. Didn’t actually have built-in GD support turned on anyway. Need to specify –with-gd , And with-jpeg-dir=/usr/locak and with-freetype-dir=/usr local

 So, final config for php is

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 --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --enable-gd-native-ttf --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-openssl --with-xmlrpc --with-xsl=/usr --without-pear --with-gd --with-jpeg-dir=/usr/local --with-freetype-dir=/usr/local

 And by golly, it all works!

About Wesley Wright

Born on a mountain top near New York City, Craziest state in the land of the pretty. Raised in the woods so's he knew every tree, Killed him a bear when he was only three.
This entry was posted in Landscape Change, Projects, Scripts - Programming, Systems and Servers. Bookmark the permalink.

Leave a Reply