简体   繁体   中英

PHP API version mismatch compiling memcache for MAMP on Mac

I have my native Apache/PHP setup working correctly with PHP 5.3.15 and memcache. Everything is good there. But I want to be able to run a PHP 5.2 instance locally as well. So I decided that the easiest way to do this is with MAMP.

Installing MAMP was easy and got the server up in seconds. The only problem I am having is compiling and installing the memcache extension for 5.2.17 (the version that comes with MAMP).

Here are the steps I took to get it installed:

  1. Downloaded PHP 5.2.17 source files and placed them in my MAMP/bin/php/php5.2.17/include/php folder.
  2. Downloaded memcache-2.2.7 and extracted the contents to /tmp.
  3. $ /Applications/MAMP/bin/php/php5.2.17/bin/phpize to set up env for 5.2.17.
  4. $ MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/MAMP/bin/php/php5.2.17/bin/php-config
  5. $ make
  6. $ cp /tmp/memcache-2.2.7/memcache-2.2.7/modules/memcache.so /Applications/MAMP/bin/php/php5.2.17/lib/php/extensions/no-debug-non-zts-20060613
  7. Added extension=memcache.so to my php.ini.
  8. Restarted the server.

This was the output from the phpize:

Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions

I get this error in the php log:

04-Jul-2013 00:32:03] PHP Warning:  PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

From the phpize command I would have thought that the extension was built with the correct API version. But the API log tells me otherwise. It's also beneficial to note that 20090626 is the API version of my native PHP. So I think its still compiling with my native version (not sure though).

Anyone know why it's not compiling with the correct API version?

OK so it seems that if you are using PHP 5.2.17 you have to use memcache-2.2.5 for it to load correctly. I have been thinking about this issue for a few days, decided to compile an older version and it worked!! THANK GOD!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM