1.首先根据php版本进行phpmemcached插件的选择下载
http://pecl.php.net/package/memcached
php-memcached 3.x:
Supports PHP 7.0 - 7.1.
Requires libmemcached 1.x or higher.
Optionally supports igbinary 2.0 or higher.
Optionally supports msgpack 2.0 or higher.
php-memcached 2.x:
Supports PHP 5.2 - 5.6.
Requires libmemcached 0.44 or higher.
Optionally supports igbinary 1.0 or higher.
Optionally supports msgpack 0.5 or higher.
2.对下载的文件进行解压 这里我以memcached-2.2.0.tgz为例
tar -xzf memcached-2.2.0.tgz
3.cd 进入memcached文件夹
cd memcached-2.2.0
4.然后依次执行以下命令:
sudo /Applications/XAMPP/xamppfiles/bin/phpize
完成后可以看到文件目录下多出几个文件 其中有一个configure
接下来执行:
./configure –with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
5.sudo make
6.sudo make install
在/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-xxxx中可以看到有memcached.so文件
最后在xampp/etc目录下找到php.ini文件,最后一行增加
extension=memcached.so
重启xampp服务即可