Mac/インストール/memcached
提供: 初心者エンジニアの簡易メモ
目次
インストール
brew install memcached
自動起動
起動と、自動起動
brew services start memcached
旧
ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
apacheからmemcachedを利用
準備
brew install zlib
インストール
$ /opt/homebrew/opt/php/bin/pecl install memcached
以下のようにdirを入れる。
libmemcached directory [no] :/opt/homebrew/opt/libmemcached zlib directory [no] :/opt/homebrew/opt/zlib
php.iniに以下が、追加されてることを確認。
extension="memcached.so"
php.iniの位置確認
$ php --ini /opt/homebrew/etc/php/8.5/php.ini
php-memcachedサンプル
$mem = new Memcached();
$mem->addServer("127.0.0.1",11211);
$mem->set("test","hello");
echo $mem->get("test");
その他接続などについて
linux/memcacheインストール [ショートカット]
