使用自制程序安装后如何启用 memcached PHP 扩展?

发布于 2024-12-11 12:02:42 字数 492 浏览 0 评论 0原文

我最近使用 homebrew 安装了 memcached,我不完全确定如何在我的 PHP 环境中启用它,因为我添加了 < Lion OS X 中的 /etc/php.ini 中的 code>extension=memcached.so 。

即使我也重新启动了 apache,仍然没有加载任何内容。

如果我调用 get_loaded_extensions(),我在列表中看不到 memcached,从自制软件安装时如何启用它?

编辑:

我在终端中所做的是:

$brew install memcached

它安装得很好,现在我转到 /etc/php.ini 并附加:

extension= memcached.so

I recently installed memcached with homebrew, I'm not entirely sure how to enable it on my PHP envirionment since I added extension=memcached.so in /etc/php.ini in Lion OS X.

Even I restarted apache too, nothing is still loaded.

If I call get_loaded_extensions(), I do not see memcached in the list, how can I enable it when installed from homebrew?

EDIT:

What I did in Terminal was:

$ brew install memcached

It installed just fine, now I went to /etc/php.ini and appended:

extension=memcached.so

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

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

发布评论

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

评论(7

牵强ㄟ 2024-12-18 12:02:42

安装 Memcached:

# lists all memcached related packages
brew search memcached

# install memcached as well as memcached extension for PHP
brew install memcached
brew install php54-memcached

# start memcached daemon with 24MB on port 11211 (default)
memcached -d -m 24 -p 11211

添加到您的 php.ini 文件中添加:

extension=memcached.so

重新启动 php 或 php5-fpm 和您的服务器。核实:

php -i | grep memcached
# should show memcached version, etc.

Install Memcached:

# lists all memcached related packages
brew search memcached

# install memcached as well as memcached extension for PHP
brew install memcached
brew install php54-memcached

# start memcached daemon with 24MB on port 11211 (default)
memcached -d -m 24 -p 11211

Add to your php.ini file to add:

extension=memcached.so

Restart php or php5-fpm and your server. Verify:

php -i | grep memcached
# should show memcached version, etc.
雨的味道风的声音 2024-12-18 12:02:42

安装:

brew install memcached
OR
sudo pecl install memcached

将此行添加到 /etc/php.ini:

extension = memcached.so
OR
extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so"

如果您无法找到它所在的位置,

mdfind memcached.so -name
=> /usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so

请确保它作为守护进程运行(-d):

/usr/local/bin/memcached -d

重新启动 apache:

sudo apachectl restart

Install:

brew install memcached
OR
sudo pecl install memcached

Add this line to /etc/php.ini:

extension = memcached.so
OR
extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so"

If you are having trouble finding where it lives do

mdfind memcached.so -name
=> /usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so

Make sure it is running as a daemon (-d):

/usr/local/bin/memcached -d

Restart apache:

sudo apachectl restart
情归归情 2024-12-18 12:02:42

您需要使用自制软件安装 libmemcached,而不仅仅是 memcached。执行此操作:

brew install libmemcached

然后尝试重新编译您的 memcache PHP 模块。应该很好走

You'll need to install libmemcached with homebrew, not just memcached. Do this:

brew install libmemcached

Then try recompiling your memcache PHP module. Should be good to go

分分钟 2024-12-18 12:02:42

首先,安装 memcached 库:

sudo pecl install memcached

然后,将此行添加到 /etc/php.ini

extension = memcached.so

就是这样。

First, install memcached library with:

sudo pecl install memcached

Then, add this line to /etc/php.ini:

extension = memcached.so

That's it.

愛放△進行李 2024-12-18 12:02:42

PHP 警告:PHP 启动:无法加载动态库 '/usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so'

这就是 PHP 为您提供的信息,坚持下去。

可能是:

  • 您指定的文件不存在。检查您的文件系统。
  • PHP 无法读取您指定的文件,请检查该文件的权限。
  • 您指定的文件与您的 PHP 二进制文件不兼容。检查您是否编译了正确的源代码并且编译顺利。

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so'

That's the information PHP is giving you, stick to it.

It's either:

  • The file you have specified does not exists. Check your file-system.
  • The file you've specified can not be read by PHP, check the rights of the file.
  • The file you've specified is incompatible with your PHP binary. Check if you have compiled the right sources and compilation went well.
念三年u 2024-12-18 12:02:42

在 Mac OS X El Capitan 中,您可以使用

brew install homebrew/php/php55-memcached

In Mac OS X El Capitan you can use

brew install homebrew/php/php55-memcached
胡大本事 2024-12-18 12:02:42

您可以通过以下方式安装 memcache.so 模块:(

brew install memcached-php

请注意,如果您没有正确的 Xcode 版本,则上述内容当前已损坏)

然后转到 php.ini 文件并添加以下内容(将 VERSION 替换为正确的值) :

extension="/usr/local/Cellar/memcached-php/VERSION/memcached.so"

然后重新启动apache:

sudo apachectl restart

如果您无法确定正在使用哪个php.ini文件,请尝试调用phpinfo()命令。它会准确地告诉您它正在使用哪个 php.ini 文件。

You can install the memcache.so module the following way:

brew install memcached-php

(Note the above is currently broken if you don't have the right Xcode version)

Then go to your php.ini file and add the following (Replace VERSION with the correct value):

extension="/usr/local/Cellar/memcached-php/VERSION/memcached.so"

Then restart apache:

sudo apachectl restart

If you can't figure out which php.ini file is being used, try calling the phpinfo() command. It will tell you exactly which php.ini file it's using.

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