我正在尝试在我的mac上安装memcached
。我已经下载并安装了它。我也把它添加到php。ini中。但是memcached
仍然没有加载。我意识到问题是php
和phpize
的API版本不匹配。
这是我输入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
如果有人能帮我解决这个问题,我将非常感激。欢呼。 是的,您应该通过以下步骤手动构建扩展
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
确保phpize
和php-config
指向正确的php版本。
不在/usr/bin/phpize
和/usr/include/php
确保使用--with-php-config
您需要手动构建PHP扩展。您最终使用的扩展是针对PHP 5.3的系统副本构建的,而不是您自安装的PHP 5.4。
根据您的php版本下载phpX.X.tgz,解压缩并复制文件php。zend_modules.h, zend_extension.h到include目录(如果你编辑文件并搜索定义API_VERSION,你可以检查正确的api版本,它必须与phpinfo显示的api号匹配)
换句话说,当您构建扩展时,您必须包含正确的。h文件,它可以从phpxx中获得。tgz来源