PHP7.2 connection Memcached service

Studied for a long time, he stepped on a lot of the pit, with reference to several documents to figure out. .

PHP Memcache extension installation

PHP Memcache extension package Download: https://pecl.php.net/package/memcached

If you must use PHP version 3.0 or later version of the expansion pack of 7

wget https://pecl.php.net/get/memcached-3.1.3.tgz
tar zxvf memcached-3.1.3.tgz && cd memcached-3.1.3

Look under there libmemcached installed client library, this expansion requires more than libmemcached version 1.x library, if there is a low version also need to uninstall reinstall

rpm -qa|grep libevent

There will be an error or wait for the next

If not installed

yum -y install libmemcached libmemcached-devel

Then check if there Zlib

rpm -qa|grep zlib

See someone that did not install this on top of that mistake will react, but I have previously been installed, so do not encounter.

If not installed, then also installed

yum install zlib zlib-devel

Phpize installed with my PHP is installed with the yum source, it is the default path, if it is compiled and installed modified according to their installation path.

/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config

Compile and install

make && make install

memcache.so extended position will be displayed after successful installation

We can see more of the extended memcached.so

This extension is added to the end of the file php.ini

vim /etc/php.ini

[Memcache]

extension_dir = "/usr/lib64/php/modules/"

extension = memcached.so

 

Restart PHP

systemctl restart php-fpm

Check the installation results

php -m | grep memcached

Can () function to see with phpinfo

mv /usr/local/nginx/html/index.html /usr/local/nginx/html/index.php
vim /usr/local/nginx/html/index.php

<?php

phpinfo();

?>

 

nginx -s reload

 

Published 60 original articles · won praise 9 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_44697035/article/details/100153496