2

Possible Duplicate:
How do I upgrade APC on Zend Community Server (needed for Symfony2)?

I'm trying to set up a new Symfony 2 Standard Application and it keeps telling me that I need to upgrade my php APC extension.

The thing is, on my Zend Server runnning OSX, I already have the newest version of APC, 3.1.9.

I tested on Ubuntu with the same environment, Zend Server and that same version of APC, and it works fine, so the problem is really on OSX.

Apparently, on OSX the APC extension is built-in Zend Server, while on ubuntu it is not.

Does anyone have any idea on how to fix that problem?

Community
  • 1
  • 1
Daniel Ribeiro
  • 10,156
  • 12
  • 47
  • 79
  • Duplicate: [How do I upgrade APC on Zend Community Server (needed for Symfony2)?](http://stackoverflow.com/q/7704083/3765) – leek Mar 15 '12 at 03:54
  • Well, turns out the solution to that question was not even a solution. I would like to keep using Zend Server and not switch to MAMP. Any ideas? – Daniel Ribeiro Mar 15 '12 at 10:16
  • But it doesn't work. Even if you enable or disable how much times you want, Zend Server doesn't recognize any APC extensions set up on php.ini, not as a usual extension, neither as a zend extension. – Daniel Ribeiro Mar 15 '12 at 11:29
  • Don't take me wrong, but that's not the point. I need to solve that problem. – Daniel Ribeiro Mar 15 '12 at 11:33
  • Yeah that's a good start, but they don't seem to have an answer yet. – Daniel Ribeiro Mar 15 '12 at 11:39
  • @leek, it doesn't work, I've already tried that. One question though: how do you enable the PECL APC extension on php.ini? As a zend_extension or a simple extension? – Daniel Ribeiro Mar 15 '12 at 11:41
  • Do I need to disable the built-in APC extension of Zend Server to do that? – Daniel Ribeiro Mar 15 '12 at 12:20
  • **FYI:** I have removed my comments and posted everything as an answer. – leek Mar 15 '12 at 12:43
  • If you are not satisfied with the answer on the question this is a duplicate of, you can offer a bounty on *that* question. There's a specific bounty reason for the reasons you've specified in the comments above. – casperOne Mar 17 '12 at 23:59

1 Answers1

1

The second answer here suggests it is as simple as disabling/re-enabling APC.

However, there is an open Symfony issue (#227) here.

I would suggest installing the APC extension separately and try to disable the built-in Zend Server version. If I remember correctly, the order of how extra extensions are loaded in Zend Server's php.ini matters.

If you're using Homebrew, install APC with this formula and follow the instructions on the installer (enable with extension not zend_extension). You can try it without disabling the built-in APC, but to avoid conflicts I would disable it.


Update #1: A couple more things to try:

  • Ensure Zend Optimizer+ is disabled.
  • Disable Zend Server's "APC Compatibility Mode"
  • zend_optimizer.optimization_level = 0

Update #2: Since you need a 32-bit version of APC, try this:

cd /usr/local/src
pecl download apc
tar -zxvf APC-*.tgz
cd APC-*
phpize
./configure MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load" --enable-apc-debug=no --enable-apc-filehits=no --enable-apc-spinlocks=no --enable-apc-memprotect=no --enable-apc-pthreadmutex=yes --enable-apc-pthreadrwlocks=no
make
make install

After finished, try that one on Zend Server.


Update #3: Check out this article by Ralph Schindler on "Compiling Gearman (or anything) for Zend Server CE on Snow Leopard". And here is one more. Perhaps there is something different in the './configure' commands from those articles that will work for you.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
leek
  • 11,803
  • 8
  • 45
  • 61
  • I'm at work right now, so I'm gonna try this out at the end of the day and get back to you. Thanks for the attention! – Daniel Ribeiro Mar 15 '12 at 12:56
  • 1
    Turns out this solution doesn't work. I've tried in a number ways and I have nothing. The Formula downloads the APC from pecl and the activation of it on php.ini doesn't get recognize by Zend Server. – Daniel Ribeiro Mar 16 '12 at 10:23
  • @drgomesp: Have you disable the Zend Optimizer? You cannot run both of them together. – leek Mar 16 '12 at 14:52
  • What I get now is the following message on the extensions panel: The system could not load this extension. Log message shows: /usr/local/zend/lib/php_extensions/apc.so: mach-o, but wrong architecture in Unknown on line 0 – Daniel Ribeiro Mar 16 '12 at 18:26
  • Turns out the error is caused by the extension being compiled on x86_64, and Zend Server CE only works with i386 ones. My problem now is to discover how to compile apc to i386. – Daniel Ribeiro Mar 16 '12 at 21:15
  • 1
    @drgomesp: The problem is more likely that you have the wrong version of Zend Server for your architecture. When you installed APC through homebrew, it was compiled for you (see [here](https://github.com/josegonzalez/homebrew-php/blob/master/Formula/apc-php.rb)). Try downloading a different version of Zend Server that is `x86_64`. – leek Mar 16 '12 at 21:32
  • I can't really read .rb, but I can see with the file command that the apc.so is generated as x86_64 arch, when all the extensions that come with Zend Server are i386. Can't I adapt that code with something to compile it as i386? Zend Server doesn't have a x86_64 version for OSX... – Daniel Ribeiro Mar 16 '12 at 21:42
  • @drgomesp: Try my latest update to the answers – leek Mar 16 '12 at 22:26
  • Trying to manually compile like you said on edit 2, I got this message on the logs: PHP Warning: PHP Startup: apc: Unable to initialize module Module compiled with module API=20090626 PHP compiled with module API=20100525 These options need to match in Unknown on line 0 – Daniel Ribeiro Mar 16 '12 at 23:52
  • 1
    @drgomesp: Looks like you ran `phpize` from the version of PHP that is installed with OSX and not the version that is installed with Zend Server. If you run `which php` and it doesn't point to Zend Server's `phpize` then try re-running it with an absolute path. – leek Mar 17 '12 at 00:50
  • I did figure that out and then tried to run `phpize` from the `/usr/local/zend/bin` path. Still the same problem. Any ideas? – Daniel Ribeiro Mar 17 '12 at 01:07
  • I've run out of ideas, the only thing I could say is to try and download another version of APC from [PECL](http://pecl.php.net/package/APC) and see if that will work. Go back to `3.1.6` and try that. – leek Mar 17 '12 at 03:19
  • Same error =/. Guess I'm gonna have to head to MAMP. Thanks a lot for your help though! – Daniel Ribeiro Mar 17 '12 at 03:29
  • Homebrew can install everything you need. Check out [homebrew-alt](https://github.com/adamv/homebrew-alt) for [Apache](https://github.com/adamv/homebrew-alt/blob/master/duplicates/httpd.rb) and [homebrew-php](https://github.com/josegonzalez/homebrew-php) for [PHP](https://github.com/josegonzalez/homebrew-php/blob/master/Formula/php.rb). – leek Mar 17 '12 at 04:05
  • @drgomesp: Also see my 3rd update – leek Mar 17 '12 at 04:22
  • About homebrew, it installs apc correctly, but with the wrong architecture. The article from Ralph Schindler is a good starting point. I'll check that. Thx – Daniel Ribeiro Mar 17 '12 at 15:22
  • Nothing on the Ralph Schinlder article. It's still not working =/ – Daniel Ribeiro Mar 17 '12 at 21:09