Latest: Genstatic, my first sip of coffee

Content with Style

Web Technique

Installing APC on Leopard

by Matt Dunn on February 3 2009, 12:02

There are a few steps needed to install APC on OS X Leopard. Don't worry, it may look a bit daunting if you've never had to compile anything before but it's very straight forward.

  • First, download the appropriate version of the APC package
  • Unpack it (doesn't matter where)
  • Now start Terminal and cd to the unpacked directory from the above step
  • Run 'phpize'
  • Now it needs to be configured. Copy the following configuration (note: it must be entered into the Terminal prompt as a single line)
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
  • Nearly there: now type 'make'
  • sudo make install (you will need to enter your root password)
  • Finally, add 'extension=apc.so' into your php.ini

And that's it!

Comments

  • Just to give the man a bit more of an introduction: Matt was my team leader for quite some time, and I have learned tremendous amounts from working with him. I am very very happy that I could persuade him to do the occasional post here, even more so as this is he is the first contributor for CwS apart from Matthias, Mike and me so far. A milestone, so to say.

    Good to have you here, Matt!

    by Pascal Opitz on February 3 2009, 12:07 - #

  • A similar approach for mcrypt: Plugging mcrypt into PHP, on Leopard 10.5.6

    by Pascal Opitz on February 9 2009, 15:24 - #

  • And here is something for MySQL and PDO on OS X Leopard, Intel

    Also this guy has a couple of pre-compiled binaries

    by Pascal Opitz on February 9 2009, 15:46 - #

  • Thanks. I was having a bit of trouble getting this going on my Leopard server (no problems on a PPC box running Tiger Server). Your command line for configure did something that worked and I now have it going. Here's a follow on question. I've expanded the shared memory segment to 128Mb. Is that not necessary any longer...with Tiger and surely earlier, the default shared memory segment was 4Mb.

    by Wally on February 26 2009, 14:54 - #

  • Matt,

    Thank you for this info, I got down to the second to last command before I had any problems.

    When I run 'make' I get the following errors:

    /usr/local/php5/bin/APC-3.0.19/php_apc.c:959: error: duplicate 'static'
    /usr/local/php5/bin/APC-3.0.19/php_apc.c:959: error: duplicate 'static'
    /usr/local/php5/bin/APC-3.0.19/php_apc.c:959: error: duplicate 'static'
    /usr/local/php5/bin/APC-3.0.19/php_apc.c:959: error: duplicate 'static'
    lipo: can't open input file: /var/folders/WL/WLuS6cKnE0mu8N+eRzVeDk+++TM/-Tmp-//ccPNdzLH.out (No such file or directory)
    make: *** [php_apc.lo] Error 1

    Any help would be great!!

    Thanks, Michael

    by Michael on November 10 2009, 17:06 - #

  • Michael, I'm having the same issue. Did you ever get it resolved? If others have any idea what may be causing our "php_apc.c:959: error: duplicate 'static'" build error, please let us know.

    by Paul on March 15 2010, 23:20 - #

  • To compile it, comment out line 959, or 958; the line just contains static.

    by kiamlaluno on June 30 2010, 17:43 - #

  • We have a very busy website. We've found the MacPorts APC extension (php5-apc) is a lot easier to setup and install with the MacPorts PHP build, which makes using the latest version of PHP really easy. The downside with MacPorts PHP, though, is that you have to use the MacPorts Apache instead of the Apple Apache because the latter crashes when attempting to load the MacPorts PHP module. We noticed a 50% improvement in CPU utilization with MacPorts. I'm sure a custom build could improve on that maybe another 5%, but 50% is good enough given the other benefits MacPorts offers.

    by Lando K on January 20 2011, 18:24 - #

  • So Lando, do you use this in a production environment or just as a dev box?

    by Pascal Opitz on January 22 2011, 09:27 - #


Comments for this article are closed.