原创

[wdcp]php73版本开启memcache缓存(开启PHP扩展)

wdcp 更新到 v3.3.7,突然感觉系统跑的不是很快,之前一直没有开启缓存的功能,是觉得这么点压力,php还不是问题,但最近的确很慢。为此还是开下memcache做页面缓存吧。

1.环境信息

system = centos 7.2
php    = 7.3
wdcp   = v3.3.7

2.安装MemCached

首先看下面板后台,系统设置->MemCached有没有开启,这里我因为之前已经安装过了,这篇文章不介绍如何安装。

3.安装php扩展

进入php目录,下载memcache,并且解压

cd /www/wdlinux/phps/73
wget https://pecl.php.net/get/memcache-4.0.5.2.tgz
tar -zxvf memcache-4.0.5.2.tgz
cd memcache-4.0.5.2

执行phpize,生成configure


[root]#./../bin/phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731

预配置

[root]# ./configure --with-php-config=/www/wdlinux/phps/73/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
.................
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

编译并安装

[root]# make && make install
/bin/sh /www/wdlinux/phps/73/memcache-4.0.5.2/libtool --mode=compile cc -I/www/wdlinux/phps/73/include/php -I. -I/www/wdlinux/phps/73/memcache-4.0.5.2 -DPHP_ATOM_INC -I/www/wdlinux/phps/73/memcache-4.0.5.2/include -I/www/wdlinux/phps/73/memcache-4.0.5.2/main -I/www/wdlinux/phps/73/memcache-4.0.5.2 -I/www/wdlinux/phps/73/include/php -I/www/wdlinux/phps/73/include/php/main -I/www/wdlinux/phps/73/include/php/TSRM -I/www/wdlinux/phps/73/include/php/Zend -I/www/wdlinux
..................
Libraries have been installed in:
   /www/wdlinux/phps/73/memcache-4.0.5.2/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,--rpath -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:     /www/wdlinux/phps/73/lib/php/extensions/no-debug-non-zts-20180731/

最后会有个提示Installing shared extensions:这个后面的路径要记录下来。

[root]# vim /www/wdlinux/phps/73/etc/php.ini 

在最后增加


[Memcached]
extension_dir = "/www/wdlinux/phps/73/lib/php/extensions/no-debug-non-zts-20180731/"
extension=memcache.so

在wdcp面板重启对应版本的php网站管理->PHP版本管理 然后在ssh中输入:

[root]# cd /www/wdlinux/phps/73/bin/
[root]# ./php -m | grep memcache
memcache

看到输出memcache就证明成功了。

本文来自:[wdcp]php73版本开启memcache缓存(开启PHP扩展)-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2020年12月03日,已超过 1,479 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录