6

I am trying to install memcached in my mac. I have downloaded and installed it. I added it to php.ini as well. But still memcached doesnt load. I realized that the problem is with the API version mismatch of php and phpize.

This is what I get when I do php -v

PHP Warning:  PHP Startup: memcached: 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
PHP 5.4.8 (cli) (built: Oct 30 2012 19:29:58) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

I would really appreciate if someone would help me fix this issue. Cheers.

Subash
  • 7,098
  • 7
  • 44
  • 70

3 Answers3

12

Yes, you should build the extension manually by the following step

phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

make sure you run phpize and php-config pointing to your correct php verison.

not in the /usr/bin/phpize and /usr/include/php

make sure use --with-php-config

Magic
  • 1,182
  • 2
  • 18
  • 28
2

You will need to build the PHP extension manually. The extension you've ended up with is built against the system's copy of PHP 5.3, not your self-installed PHP 5.4.

  • I have tried installing manually as well. Will you be kind enough to point me towards right direction. – Subash Jan 15 '13 at 04:47
  • Make sure to run the copy of `phpize` that was installed with PHP 5.4, *not* `/usr/bin/phpize`. –  Jan 15 '13 at 04:52
  • when I do {which php} it shows me /usr/bin/php and {which phpize} returns /usr/bin/php. So I am assuming they are both right. isnt it? – Subash Jan 15 '13 at 05:00
  • No. Those paths both refer to the system PHP (5.3). –  Jan 15 '13 at 07:11
  • I have updated both of my php. They are 5.4.8. thats the phpize -v `Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626` – Subash Jan 15 '13 at 10:48
  • PHP API 20090626 is PHP 5.3. If you're still getting that message, you've still using some of the system PHP 5.3 files. –  Jan 15 '13 at 18:03
  • How does one go about finding the phpize for the 5.4.8 or greater? – Mike Kormendy Jul 09 '13 at 20:33
  • @MikeKormendy: Depends entirely on how you installed it, but it's no different from other versions. It may be part of a separate `php-devel` (or similarly named) package. –  Jul 09 '13 at 20:51
  • I beleive the phpize was improperly configured and uses an old php install that I nolonger have on the system. I think I have to recompile php and force it to use the current version .. every time I do phpize version it reports for 5.3, but it doesn't exist on the system and all I have now is 5.4.14 – Mike Kormendy Jul 09 '13 at 22:19
  • I actually couldnt work out what the actual issue was. I ended up reinstalling the OS, installed PHP again, and installed memcached. No issues at all. So I think previously, there was a conflict with 2 versions of PHP. – Subash Nov 04 '13 at 01:06
0

Download the phpX.X.tgz in accordance to you php version, unzip and copy the files php.z, zend_modules.h, zend_extension.h to the include directory (you could check the correct api version if you edit the file and search for define API_VERSION it's must match with the api number that phpinfo shows)

In other words when you build the extension you must include the correct .h files it's can be obtained from phpxx.tgz sources