我可以使用 PECL 安装 memcached PHP 扩展吗?

发布于 2024-07-15 11:37:12 字数 1091 浏览 7 评论 0原文

我在从 PECL 安装“memcached” PHP 扩展时遇到问题,尽管我可以成功安装“memcache”扩展。 (它们是单独的 PHP 扩展。)

例如,这些命令可以正常工作:

$ sudo pecl 安装内存缓存
$ sudo pecl 安装 APC
$ sudo pecl 安装 oauth

但是,尝试安装 memcached 会导致错误:

$ sudo pecl 安装 memcached
...
ld:找不到 -lmemcached 的库
collect2: ld 返回 1 退出状态
make: *** [memcached.la] 错误 1
错误:“make”失败

我在最新的 Intel Mac 上使用 Mac Ports (macports.org) 中的 pecl、memcached 和 libmemcached。 libmemcached 库可以在 /opt/local 中找到:

/opt/local/include/libmemcached
/opt/local/include/libmemcached/libmemcached_config.h
/opt/local/lib/libmemcached.2.0.0.dylib
/opt/local/lib/libmemcached.2.dylib
/opt/local/lib/libmemcached.a
/opt/local/lib/libmemcached.dylib
/opt/local/lib/libmemcached.la

知道我可能做错了什么吗?

I'm having trouble installing the "memcached" PHP extension from PECL, though I can successfully installed the "memcache" extension. (They are separate PHP extensions.)

For example, these commands work okay:

$ sudo pecl install memcache
$ sudo pecl install APC
$ sudo pecl install oauth

However, attempting to install memcached causes errors:

$ sudo pecl install memcached
...
ld: library not found for -lmemcached
collect2: ld returned 1 exit status
make: *** [memcached.la] Error 1
ERROR: `make' failed

I'm using pecl, memcached, and libmemcached from Mac Ports (macports.org) on a recent Intel Mac. The libmemcached libraries can be found in /opt/local:

/opt/local/include/libmemcached
/opt/local/include/libmemcached/libmemcached_config.h
/opt/local/lib/libmemcached.2.0.0.dylib
/opt/local/lib/libmemcached.2.dylib
/opt/local/lib/libmemcached.a
/opt/local/lib/libmemcached.dylib
/opt/local/lib/libmemcached.la

Any idea what I may be doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冷默言语 2024-07-22 11:37:13

这里的情况也一样。 我必须执行上述操作,但具有明确的路径名(我在/ opt / local之外运行我的php等)

  • /opt/local/bin/pecl下载memcached
  • tar zxvf memcached-1.0.0 .tgz
  • cd memcached-1.0.0
  • /opt/local/bin/phpize
  • ./configure --prefix=/opt/local --with-php-config=/opt/local/ bin/php-config --with-libmemcached-dir=/opt/local
  • make
  • make install

通常这种东西在带有 macports 的 os x 上非常简单,但是还没有 php5-memcached 包(只有一个)对于较旧的 memcache(无“d”)包)。 哦,我还必须安装旧版本的 libmemcached,因为最新版本无法在 os x 10.5.8 上编译。 哦!

same situation here. i had to do the above, but with explicit path names (i run my php etc. out of /opt/local)

  • /opt/local/bin/pecl download memcached
  • tar zxvf memcached-1.0.0.tgz
  • cd memcached-1.0.0
  • /opt/local/bin/phpize
  • ./configure --prefix=/opt/local --with-php-config=/opt/local/bin/php-config --with-libmemcached-dir=/opt/local
  • make
  • make install

normally this kind of stuff is pretty simple on os x with macports, but there is no php5-memcached package yet (only one for the older, memcache (no "d") package). oh, an i also had to install an older version of libmemcached, since the latest version didn't compile on os x 10.5.8 for me. oy!

爱本泡沫多脆弱 2024-07-22 11:37:13

正如您所看到的,新的 memcached 扩展使用 libmemcached 来完成繁重的工作。 如果是 Linux,我会说你可能没有在 ld.so.conf 中列出 /opt/local/lib/ (并运行“ldconfig”)。

不过 MaxOSX 不使用它。 然而,它显然可以从“端口”安装。 http://lsimons.wordpress.com/2008/05 /01/serious-php-part-1/

As you've seen, the new memcached extension, uses libmemcached to do the heavy lifting. If it were Linux, I'd say that it was possible that you don't have /opt/local/lib/ listed in ld.so.conf (and run 'ldconfig').

MaxOSX doesn't use that though. It is, however installable from 'ports' apparently. http://lsimons.wordpress.com/2008/05/01/serious-php-part-1/

゛清羽墨安 2024-07-22 11:37:13

好吧,经过多次尝试,只有这个解决方案适合我。

  1. 安装XAMPP
  2. 安装brew (https://github.com/Homebrew/homebrew/wiki/Installation)
  3. $ brew
  4. install libmemcached
  5. cd /Applications/XAMPP/xamppfiles/bin/
  6. $ sudo ./pecl install memcached

构建过程成功完成正在安装
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/memcached.so'
安装确定:channel://pecl.php.net/memcached-2.2.0 配置
选项“php_ini”未设置为 php.ini 位置您应该添加
“extension=memcached.so”到 php.ini

瞧!

Well, after many tries only this solution works for me.

  1. Install XAMPP
  2. Install brew (https://github.com/Homebrew/homebrew/wiki/Installation)
  3. $ brew
  4. install libmemcached
  5. cd /Applications/XAMPP/xamppfiles/bin/
  6. $ sudo ./pecl install memcached

Build process completed successfully Installing
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/memcached.so'
install ok: channel://pecl.php.net/memcached-2.2.0 configuration
option "php_ini" is not set to php.ini location You should add
"extension=memcached.so" to php.ini

VOILA !!

鼻尖触碰 2024-07-22 11:37:12

Andrei Zmievski(memcached 插件的开发者)用以下说明回复了我的电子邮件请求:

$ pecl download memcached
$ tar zxvf memcached-1.0.0.tgz (or whatever version downloads)
$ cd memcached-1.0.0
$ phpize
$ ./configure --with-libmemcached-dir=/opt/local
$ make
$ sudo make install

这非常有效。

Andrei Zmievski (developer of the memcached plugin) kindly answered my email request with the following instructions:

$ pecl download memcached
$ tar zxvf memcached-1.0.0.tgz (or whatever version downloads)
$ cd memcached-1.0.0
$ phpize
$ ./configure --with-libmemcached-dir=/opt/local
$ make
$ sudo make install

This worked perfectly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文