APC / OSX update (10.5 server)

      Comments Off on APC / OSX update (10.5 server)

Some time back I posted a few notes on using APC (Alternative PHP Cache) on a BSD-based system. The important idea then was to increase the size of the shared memory segment from the default 4MB.

Yesterday, I decided it was time to implement an APC cache on a Leopard-based OS X machine to improve php performance on that box as I added a new research portal to the server.

A few updates to the process for Leopard (10.5) servers:

1. Down latest version of APC code.
2. Use this command line to configure the code before issuing the make and make install commands (thanks to Pascal Opitz’s Content with Style for this tip):

[sourcecode language=’bash’]
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
[/sourcecode]

You’ll also want to expand your shared memory segment on the server. Under 10.5, you create a file /etc/sysctl.conf and add the appropriate values. This example makes a 128Mb shared memory segment:
[sourcecode language=’html’]

kern.sysv.shmmax=134217728
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=32768

[/sourcecode]