phpize and php api version doesnt match
Asked Answered
T

3

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.

Tisbee answered 15/1, 2013 at 4:5 Comment(2)
how are you installing PHP and memcached? Are you using a package manager?Sequence
I compiled php manually. But used brew to install memcachedTisbee
B
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.

Blas answered 15/1, 2013 at 4:44 Comment(10)
I have tried installing manually as well. Will you be kind enough to point me towards right direction.Tisbee
Make sure to run the copy of phpize that was installed with PHP 5.4, not /usr/bin/phpize.Blas
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?Tisbee
No. Those paths both refer to the system PHP (5.3).Blas
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: 220090626Tisbee
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.Blas
How does one go about finding the phpize for the 5.4.8 or greater?Denn
@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.Blas
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.14Denn
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.Tisbee
G
11

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

Gris answered 29/5, 2015 at 17:0 Comment(2)
thank you very, very much for the --with-php-config hint!! Is there any doc where we find out which arguments may be passed to ./configure?Literally
@Literally ./configure --helpCaryopsis
B
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.

Blas answered 15/1, 2013 at 4:44 Comment(10)
I have tried installing manually as well. Will you be kind enough to point me towards right direction.Tisbee
Make sure to run the copy of phpize that was installed with PHP 5.4, not /usr/bin/phpize.Blas
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?Tisbee
No. Those paths both refer to the system PHP (5.3).Blas
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: 220090626Tisbee
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.Blas
How does one go about finding the phpize for the 5.4.8 or greater?Denn
@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.Blas
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.14Denn
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.Tisbee
W
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

Will answered 3/1, 2014 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.