yum 安装memecached
yum install -y memcached
安装依赖库 libmemcached
启动memcached
memcached -d -m 100 -u root -l 192.168.124.188 -p 11211 -c 512 -P /tmp/memcached.pid
参数说明:
-d选项是启动一个守护进程;
-m是分配给memcache使用的内存数量,单位是mB,我这里是100mB;
-u是运行memcache的用户,我这里是root;
-l是监听的服务器IP地址我这里指定了服务器的IP地址192.168.124.188;
-p是设置memcache监听的端口,我这里设置了11211,最好是1024以上的端口;
-c选项是最大运行的并发连接数,默认是1024,我这里设置了512,按照你服务器的负载量来设定;
-P是设置保存memcache的pid文件,我这里是保存在 /tmp/memcached.pid;
//3.检查是否启动成功
ps -ef | grep memcached
安装PHP7的memcached扩展
[root@localhost ~]# locate php-config
/data0/opt/php-5.3.29/scripts/php-config
/data0/opt/php-5.3.29/scripts/php-config.in
/data0/opt/php-5.3.29/scripts/man1/php-config.1
/data0/opt/php-5.3.29/scripts/man1/php-config.1.in
/data0/opt/php53/bin/php-config
/data0/opt/php53/man/man1/php-config.1
/data0/opt/php54/bin/php-config
/data0/opt/php54/php/man/man1/php-config.1
/data0/opt/php55/bin/php-config
/data0/opt/php55/php/man/man1/php-config.1
/data0/opt/php7/bin/php-config
/data0/opt/php7/php/man/man1/php-config.1
/data1/sources/php-5.3.29/scripts/php-config
/data1/sources/php-5.3.29/scripts/php-config.in
/data1/sources/php-5.3.29/scripts/man1/php-config.1
/data1/sources/php-5.3.29/scripts/man1/php-config.1.in
/data1/sources/php-5.4.45/scripts/php-config
/data1/sources/php-5.4.45/scripts/php-config.in
/data1/sources/php-5.4.45/scripts/man1/php-config.1.in
/data1/sources/php-5.5.31/scripts/php-config
/data1/sources/php-5.5.31/scripts/php-config.in
/data1/sources/php-5.5.31/scripts/man1/php-config.1
/data1/sources/php-5.5.31/scripts/man1/php-config.1.in
/data1/sources/php-7.0.2/scripts/php-config
/data1/sources/php-7.0.2/scripts/php-config.in
/data1/sources/php-7.0.2/scripts/man1/php-config.1
/data1/sources/php-7.0.2/scripts/man1/php-config.1.in
/data2/software/201706/php-5.6.30/scripts/php-config
/data2/software/201706/php-5.6.30/scripts/php-config.in
/data2/software/201706/php-5.6.30/scripts/man1/php-config.1
/data2/software/201706/php-5.6.30/scripts/man1/php-config.1.in
/root/.local/share/fish/generated_completions/php-config.fish
/usr/home/finance/.local/share/fish/generated_completions/php-config.fish
/usr/home/jiaojie/.local/share/fish/generated_completions/php-config.fish
/usr/local/bin/php-config
/usr/local/man/man1/php-config.1
[root@localhost ~]# wget -c http://pecl.php.net/get/memcached-3.0.4.tgz
--2018-08-15 10:25:59-- http://pecl.php.net/get/memcached-3.0.4.tgz
Resolving pecl.php.net... 104.236.228.160
Connecting to pecl.php.net|104.236.228.160|:80... connected.
HTTP request sent,awaiting response... 200 OK
Length: 78776 (77K) [application/octet-stream]
Saving to: “memcached-3.0.4.tgz”
100%[======================================================================================>] 78,776 169K/s in 0.5s
2018-08-15 10:26:02 (169 KB/s) - “memcached-3.0.4.tgz” saved [78776/78776]
[root@localhost ~]# cd memcached-3.0.4
[root@localhost ~]# tar -zxvf memcached-3.0.4.tgz
[root@localhost memcached-3.0.4]# /data0/opt/PHP7/bin/PHPize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
[root@localhost memcached-3.0.4]# ./configure --with-PHP-config=/data0/opt/PHP7/bin/PHP-config --disable-memcached-sasl
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /data0/opt/PHP7
checking for PHP includes... -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib
checking for PHP extension directory... /data0/opt/PHP7/lib/PHP/extensions/no-debug-zts-20151012
checking for PHP installed headers prefix... /data0/opt/PHP7/include/PHP
checking if debug is enabled... no
checking if zts is enabled... yes
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable memcached support... yes,shared
checking for libmemcached... yes,shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... no
checking whether to enable memcached protocol support... no
checking whether to use system FastLZ bibrary... no
checking for ZLIB... yes,shared
checking for pkg-config... /usr/bin/pkg-config
checking for zlib location... /usr
checking for session includes... /data0/opt/PHP7/include/PHP
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
checking for libmemcached location... found version 1.0.18,under /usr/local
checking whether to enable sasl support... no
checking whether memcached_exist is defined... no
checking for memcached protocol support... disabled
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
[root@localhost memcached-3.0.4]# make && make install
/bin/sh /root/memcached-3.0.4/libtool --mode=compile cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_memcached.c -o PHP_memcached.lo
mkdir .libs
cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_memcached.c -fPIC -DPIC -o .libs/PHP_memcached.o
/bin/sh /root/memcached-3.0.4/libtool --mode=compile cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_libmemcached_compat.c -o PHP_libmemcached_compat.lo
cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_libmemcached_compat.c -fPIC -DPIC -o .libs/PHP_libmemcached_compat.o
/bin/sh /root/memcached-3.0.4/libtool --mode=compile cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/g_fmt.c -o g_fmt.lo
cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/g_fmt.c -fPIC -DPIC -o .libs/g_fmt.o
/bin/sh /root/memcached-3.0.4/libtool --mode=compile cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/fastlz/fastlz.c -o fastlz/fastlz.lo
mkdir fastlz/.libs
cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/fastlz/fastlz.c -fPIC -DPIC -o fastlz/.libs/fastlz.o
/bin/sh /root/memcached-3.0.4/libtool --mode=compile cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_memcached_session.c -o PHP_memcached_session.lo
cc -I/data0/opt/PHP7/include/PHP -I. -I/root/memcached-3.0.4 -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -c /root/memcached-3.0.4/PHP_memcached_session.c -fPIC -DPIC -o .libs/PHP_memcached_session.o
/bin/sh /root/memcached-3.0.4/libtool --mode=link cc -DPHP_ATOM_INC -I/root/memcached-3.0.4/include -I/root/memcached-3.0.4/main -I/root/memcached-3.0.4 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -I/data0/opt/PHP7/include/PHP -I/data0/opt/PHP7/include/PHP/main -I/data0/opt/PHP7/include/PHP/TSRM -I/data0/opt/PHP7/include/PHP/Zend -I/data0/opt/PHP7/include/PHP/ext -I/data0/opt/PHP7/include/PHP/ext/date/lib -I/usr/local/include -o memcached.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/memcached-3.0.4/modules PHP_memcached.lo PHP_libmemcached_compat.lo g_fmt.lo fastlz/fastlz.lo PHP_memcached_session.lo -Wl,/usr/local/lib -L/usr/local/lib -lz -lmemcached -lmemcachedutil
cc -shared .libs/PHP_memcached.o .libs/PHP_libmemcached_compat.o .libs/g_fmt.o fastlz/.libs/fastlz.o .libs/PHP_memcached_session.o -Wl,--rpath -Wl,/usr/local/lib -Wl,/usr/local/lib -L/usr/local/lib -lz /usr/local/lib/libmemcached.so /usr/local/lib/libmemcachedutil.so -Wl,-rpath -Wl,-soname -Wl,memcached.so -o .libs/memcached.so
creating memcached.la
(cd .libs && rm -f memcached.la && ln -s ../memcached.la memcached.la)
/bin/sh /root/memcached-3.0.4/libtool --mode=install cp ./memcached.la /root/memcached-3.0.4/modules
cp ./.libs/memcached.so /root/memcached-3.0.4/modules/memcached.so
cp ./.libs/memcached.lai /root/memcached-3.0.4/modules/memcached.la
PATH="$PATH:/sbin" ldconfig -n /root/memcached-3.0.4/modules
Libraries have been installed in:
/root/memcached-3.0.4/modules
If you ever happen to want to link against installed libraries
in a given directory,LIBDIR,you must either use libtool,and
specify the full pathname of the library,or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information,such as the ld(1) and ld.so(8) manual pages.
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /data0/opt/PHP7/lib/PHP/extensions/no-debug-zts-20151012/
[root@localhost memcached-3.0.4]# ll /data0/opt/PHP7/lib/PHP/extensions/no-debug-zts-20151012/
total 12292
-rwxr-xr-x 1 root root 47910 Jul 26 2016 hrtime.so
-rwxr-xr-x 1 root root 349097 Aug 15 10:29 memcached.so
-rwxr-xr-x 1 root root 239422 Feb 4 2016 memcache.so
-rw-r--r-- 1 root root 2814752 Apr 14 2016 mongodb.so
-rwxr-xr-x 1 root root 1648282 Feb 4 2016 opcache.a
-rwxr-xr-x 1 root root 890264 Feb 4 2016 opcache.so
-rwxr-xr-x 1 root root 417434 Jul 27 14:40 rdkafka.so
-rwxr-xr-x 1 root root 1469460 Feb 4 2016 redis.so
-rwxr-xr-x 1 root root 3625514 May 31 2017 swoole.so
-rwxr-xr-x 1 root root 1061085 Feb 4 2016 xdebug.so
[root@localhost memcached-3.0.4]# locate PHP.ini
/data0/opt/PHP-5.3.29/PHP.ini-development
/data0/opt/PHP-5.3.29/PHP.ini-production
/data0/opt/PHP53/etc/PHP.ini
/data0/opt/PHP54/etc/PHP.ini
/data0/opt/PHP55/etc/PHP.ini
/data0/opt/PHP7/etc/PHP.ini
/data1/sources/PHP-5.3.29/PHP.ini-development
/data1/sources/PHP-5.3.29/PHP.ini-production
/data1/sources/PHP-5.4.45/PHP.ini-development
/data1/sources/PHP-5.4.45/PHP.ini-production
/data1/sources/PHP-5.4.45/ext/igbinary-2.0.1/igbinary.PHP.ini
/data1/sources/PHP-5.5.31/PHP.ini-development
/data1/sources/PHP-5.5.31/PHP.ini-production
/data1/sources/PHP-5.5.31/ext/igbinary-2.0.1/igbinary.PHP.ini
/data1/sources/PHP-5.5.31/ext/memcached-2.2.0/tmp-PHP.ini
/data1/sources/PHP-7.0.2/PHP.ini-development
/data1/sources/PHP-7.0.2/PHP.ini-production
/data2/software/201706/PHP-5.6.30/PHP.ini-development
/data2/software/201706/PHP-5.6.30/PHP.ini-production
/data2/software/201706/PHP-5.6.30/tmp-PHP.ini
/etc/PHP.ini
/usr/local/lib/PHP.ini
/usr/local/lib64/PHP.ini
/usr/share/doc/PHP-common-5.3.3/PHP.ini-development
/usr/share/doc/PHP-common-5.3.3/PHP.ini-production
[root@localhost memcached-3.0.4]# vi /data0/opt/PHP7/etc/PHP.ini
extension=/data0/opt/PHP7/lib/PHP/extensions/no-debug-zts-20151012/memcached.so
[root@localhost memcached-3.0.4]# PHP7 -m|grep memcache
memcache
memcached
[root@localhost memcached-3.0.4]# PHP7 -r '$m=new memcached;var_dump($m);'
Command line code:1:
class Memcached#1 (0) {
}
修改配置文件
$ sudo vim /etc/php/7.0/fpm/php.ini
在末尾添加
[Memcached]
extension=memcached.so
重启php
$ sudo systemctl restart php7.0-fpm