使用自制程序安装后如何启用 memcached PHP 扩展?
我最近使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
安装 Memcached:
添加到您的
php.ini
文件中添加:重新启动 php 或 php5-fpm 和您的服务器。核实:
Install Memcached:
Add to your
php.ini
file to add:Restart php or php5-fpm and your server. Verify:
安装:
将此行添加到 /etc/php.ini:
如果您无法找到它所在的位置,
请确保它作为守护进程运行(-d):
重新启动 apache:
Install:
Add this line to /etc/php.ini:
If you are having trouble finding where it lives do
Make sure it is running as a daemon (-d):
Restart apache:
您需要使用自制软件安装 libmemcached,而不仅仅是 memcached。执行此操作:
然后尝试重新编译您的 memcache PHP 模块。应该很好走
You'll need to install libmemcached with homebrew, not just memcached. Do this:
Then try recompiling your memcache PHP module. Should be good to go
首先,安装 memcached 库:
然后,将此行添加到
/etc/php.ini
:就是这样。
First, install memcached library with:
Then, add this line to
/etc/php.ini
:That's it.
这就是 PHP 为您提供的信息,坚持下去。
可能是:
That's the information PHP is giving you, stick to it.
It's either:
在 Mac OS X El Capitan 中,您可以使用
In Mac OS X El Capitan you can use
您可以通过以下方式安装 memcache.so 模块:(
请注意,如果您没有正确的 Xcode 版本,则上述内容当前已损坏)
然后转到 php.ini 文件并添加以下内容(将 VERSION 替换为正确的值) :
然后重新启动apache:
如果您无法确定正在使用哪个php.ini文件,请尝试调用phpinfo()命令。它会准确地告诉您它正在使用哪个 php.ini 文件。
You can install the memcache.so module the following way:
(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):
Then restart apache:
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.