1. yum
    1. 利用yum search查找扩展包yum search memcached php
    2. 使用yum install安装扩展包
  2. pecl
    1. 安装pecl
      1. curl -o go-pear.php http://pear.php.net/go-pear.phar
      2. php go-pear.php
      3. 查看pecl是否安装成功pecl -V,返回类似下边的结果

Warning: Invalid argument supplied for foreach() in Command.php on line 249 Warning: Invalid argument supplied for foreach() in /usr/share/ pear/PEAR/Command.php on line 249 Warning: Invalid argument supplied for foreach() in Command.php on line 249 Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249 Warning: Invalid argument supplied for foreach() in Command.php on line 249 Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249 Warning: Invalid argument supplied for foreach() in Command.php on line 249 …```

    4. 解决办法
        1. `vim /usr/bin/pecl`
        2. 找到下面这句``` exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@"```
        3. 去掉 -n,ok

2. 用pecl安装扩展`pecl install memcached`