如何在安装了homebrew之后启用memcached PHP扩展?

时间:2022-09-19 07:45:14

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.

我最近在homebrew上安装了memcached,我不太确定如何在我的PHP环境中启用它,因为我添加了扩展=memcached。所以在/etc/php.在狮子OS X。

Even I restarted apache too, nothing is still loaded.

即使我重新启动了apache,也没有加载任何东西。

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

如果我调用get_loaded_extensions(),我不会在列表中看到memcached,那么在从homebrew中安装时如何启用它呢?

EDIT:

编辑:

What I did in Terminal was:

我在终端所做的是:

$ brew install memcached

酿造安装memcached美元

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

它安装得很好,现在我去了/etc/php。ini和附加:

extension=memcached.so

扩展= memcached.so

8 个解决方案

#1


9  

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

PHP警告:PHP启动:无法加载动态库的/usr/lib/ PHP /扩展/未调试-未调试-20090626/ memcachedso。

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

这就是PHP给你的信息,坚持下去。

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.
  • 您指定的文件不能由PHP读取,请检查文件的权限。
  • The file you've specified is incompatible with your PHP binary. Check if you have compiled the right sources and compilation went well.
  • 您指定的文件与PHP二进制文件不兼容。检查您是否已经编译了正确的源代码并进行了良好的编译。

#2


40  

Install Memcached:

安装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:

添加到您的php。ini文件来添加:

extension=memcached.so

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

重新启动php或php5-fpm和服务器。验证:

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

#3


11  

Install:

安装:

brew install memcached
OR
sudo pecl install memcached

Add this line to /etc/php.ini:

将这一行添加到/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):

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

/usr/local/bin/memcached -d

Restart apache:

重新启动apache:

sudo apachectl restart

#4


10  

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

您需要使用homebrew安装libmemcached,而不只是memcached。这样做:

brew install libmemcached

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

然后尝试重新编译memcache PHP模块。该走了吗?

#5


6  

First, install memcached library with:

首先,安装memcached库:

sudo pecl install memcached

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

然后,将这一行添加到/etc/php.ini:

extension = memcached.so

That's it.

就是这样。

#6


4  

In Mac OS X El Capitan you can use

在Mac OS X El Capitan你可以使用。

brew install homebrew/php/php55-memcached

#7


2  

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

您可以安装memcache。所以模块如下:

brew install memcached-php

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

(如果您没有正确的Xcode版本,请注意以上内容目前已被打破)

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

然后切换到php。ini文件并添加以下内容(用正确的值替换版本):

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

Then restart apache:

然后重新启动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.

如果你不知道哪个php。正在使用ini文件,尝试调用phpinfo()命令。它会准确地告诉你哪个php。它使用ini文件。

#8


1  

It's a 2016 so just try :

这是2016年的尝试:

brew search memcached

You will find result and install what version of php you are using.

您将找到结果并安装您正在使用的php版本。

Don't know if someone else still looking for this :)

不知道别人还在找这个吗?

#1


9  

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

PHP警告:PHP启动:无法加载动态库的/usr/lib/ PHP /扩展/未调试-未调试-20090626/ memcachedso。

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

这就是PHP给你的信息,坚持下去。

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.
  • 您指定的文件不能由PHP读取,请检查文件的权限。
  • The file you've specified is incompatible with your PHP binary. Check if you have compiled the right sources and compilation went well.
  • 您指定的文件与PHP二进制文件不兼容。检查您是否已经编译了正确的源代码并进行了良好的编译。

#2


40  

Install Memcached:

安装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:

添加到您的php。ini文件来添加:

extension=memcached.so

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

重新启动php或php5-fpm和服务器。验证:

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

#3


11  

Install:

安装:

brew install memcached
OR
sudo pecl install memcached

Add this line to /etc/php.ini:

将这一行添加到/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):

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

/usr/local/bin/memcached -d

Restart apache:

重新启动apache:

sudo apachectl restart

#4


10  

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

您需要使用homebrew安装libmemcached,而不只是memcached。这样做:

brew install libmemcached

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

然后尝试重新编译memcache PHP模块。该走了吗?

#5


6  

First, install memcached library with:

首先,安装memcached库:

sudo pecl install memcached

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

然后,将这一行添加到/etc/php.ini:

extension = memcached.so

That's it.

就是这样。

#6


4  

In Mac OS X El Capitan you can use

在Mac OS X El Capitan你可以使用。

brew install homebrew/php/php55-memcached

#7


2  

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

您可以安装memcache。所以模块如下:

brew install memcached-php

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

(如果您没有正确的Xcode版本,请注意以上内容目前已被打破)

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

然后切换到php。ini文件并添加以下内容(用正确的值替换版本):

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

Then restart apache:

然后重新启动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.

如果你不知道哪个php。正在使用ini文件,尝试调用phpinfo()命令。它会准确地告诉你哪个php。它使用ini文件。

#8


1  

It's a 2016 so just try :

这是2016年的尝试:

brew search memcached

You will find result and install what version of php you are using.

您将找到结果并安装您正在使用的php版本。

Don't know if someone else still looking for this :)

不知道别人还在找这个吗?