admin on April 20th, 2008

So… as you know, besides the day job, and doing SoundtrackNet stuff (yes, I have a queue of things I’m going to be trudging through for the rest of the night now)… I’m also doing some website hosting under the guise of SoundtrackNet. One of them happens to be Ryan Keaveney’s “Music for a Darkened People”, which is Danny Elfman’s site (unofficially).

He put in a request to “blog-igfy” it, and since I needed to start managing my blog (see and read here), I heard from a co-worker that there is WordPress MU (multiple-user) which could get me to the end of: 1) centralized management, and 2) a platform to offer some more services to people. Always up for a challenge, I decided that would be Saturday.. it’s now Sunday evening… you get the gist.

What became of this was the fact that plugins and theme management work differently on a multi-user setup than the regular Word Press… oh, yay. One of the things I REALLY wanted to take care of was the CAPTCHA piece for spam and registrations (to eventually have things self-maintain and be a little harder for dorks to post). Well, this required a fair bit of hacking since we host on OS X 10.5.x and Apple fond it in their right minds to NOT include a lot of useful bit’s like GD and T1Fonts support in their PHP (as well as mySQL too). I’ve hacked before to get mySQL to work with PHP Apache2 and the good ole OS. Now, it was getting GD to work… on a PPC (not i386) Mac. Prolly easier on the i386, not so on the PPC.

So, for you lovely readers out there, here’s a few config tips.

One, osx.tpicdesk.com is your friend, since this and DarwinPorts config files and one post on the Apple Support forums helped iron out the crap involved.

So, in short, follow the bouncing ball:

1) download the source packages for fontconfig, freetype, GD, jpeg, libpng, openssl, t1lib, and PHP. I also added Suhosin as well, so grab that too, it’ll be worth it in a later tutorial on securing PHP.

2) build and install fontconfig w/o the docs

3) build freetype, but after a day of this, I found that the base configure for freetype causes bad things in the OS. so the following config string is to be used:

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

yes, that’s QuickDraw folks… it breaks things.. BADLY

4) build your jpeg and png libraries so they are installed in /usr/local, pretty simple, I don’t think I threw and odd config flags there.

5) build GD… this does seemingly detect JIS Japanese fonts and the XPM libraires, but when they get jiggered into the PHP module, they get lost, but I don’t really care… I’m not Japanese, nor do I want XPM capabilities right now. Here’s the config string:

./configure --with-freetype=/usr/local --with-fontconfig=/usr/local
 --with-png=/usr/local --with-jpeg=/usr/local

6) Now you’re ready for PHP. Grab it, uncompress it, and.. I should note, this is for Leopard (10.5.x Server), and then apply the Suhosin patch per instructions (this is for 5.2.5 of PHP as it stands). Once you run the patch command on the PHP source, run this config string:

./configure  --disable-dependency-tracking --enable-bcmath --enable-calendar
 --enable-cli --enable-dba --enable-dbx --enable-exif --enable-filepro
 --enable-ftp --enable-mbregex --enable-mbstring --enable-soap --enable-sockets
 --enable-suhosin --enable-trans-sid --enable-wddx --infodir=/usr/share/info
 --mandir=/usr/share/man --prefix=/usr --sysconfdir=/private/etc
 --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with-curl=/usr
 --with-freetype-dir=/usr/local --with-gd=/usr/local --with-iodbc=/usr
 --with-jpeg-dir=/usr/local/lib --with-kerberos=/usr --with-ldap=/usr
 --with-mysql-sock=/var/mysql --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config
 --with-openssl=/usr --with-png-dir=/usr/local/lib --with-xml --with-xmlrpc
 --with-xsl=/usr --with-zlib-dir=/usr --without-pdo-sqlite --without-pear
 --without-sqlite --with-t1lib=/usr/local/lib --enable-gd-native-ttf
 --enable-gd-jis-conv --enable-gd-imgstrttf --with-xpm-dir=/usr/X11R6

It’ll complain about some unrecognized config flags, but it recognized them. Now sit back, type “make”, then “make test”, the watch for any odd stuff, and finally, “make install”. Now, I should remind you, it would have been good to back things up!

7) Finally, for you PPC people that get symbol errors because OS X assumes you’re running and compiling for multiple architectures, you can force the stupidity to end (at least until Apple updates apache2) by also issuing these commands to slim down the httpd universal binary:

cd /usr/sbin
cp httpd httpd.ub
rm httpd
lipo -thin ppc7400 httpd.ub -output httpd.ppc
lipo -info httpd.ppc
(should report : "Non-fat file: httpd.ppc is architecture:
ppc7400" - NOTE: this is for a G5)
ln -s httpd.ppc httpd
apachectl configtest (check to see if it throws errors, if not then...)
apachectl graceful

8) Profit…

So that’s it for the PHP and GD wizardry… I’m still mucking about with WorPress, as I found that there are some sloppily coded plugins I’ll need to hack for my own sake (back-end things), but it’s running if you’re able to read this post…

Cheers…

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.