Home Backend Development PHP Problem How to install memcache extension in php5.5

How to install memcache extension in php5.5

Feb 22, 2021 pm 02:38 PM

How to install the memcache extension in php5.5: 1. Download and decompress the memcache extension; 2. Use the phpize command to compile; 3. Use the make command to install; 4. Edit the php.ini configuration file and restart php -fpm.

How to install memcache extension in php5.5

The operating environment of this article: red hat enterprise linux 7.4 system, php 5.5, thinkpad t480 computer.

Specific steps:

1. Download and unzip.

wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
Copy after login

2. Compile. Use phpize and php-config according to the actual situation.

[root@www memcache-2.2.7]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:     20131106
Zend Module Api No:   20131226
Zend Extension Api No:  220131226
[root@www memcache-2.2.7]# ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
Copy after login

3. Installation. make;make install

[root@www memcache-2.2.7]# make install
Installing shared extensions:   /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Copy after login

4. Modify php.ini (add extension=memcache.so) and restart php-fpm.

How to install memcache extension in php5.5

# Let’s test the connectivity between php and memcache under Linux. Assume that the memcached server side is at 127.0.0.1. Generate the op_mem.php file, the code is as follows:

<?php
  $memcache = new Memcache;
  $memcache->connect(&#39;127.0.0.1&#39;,11211) or die("Could not connect Mc server");
  $memcache->set(&#39;key&#39;,&#39;oldboy book&#39;);
  $get= $memcache->get(&#39;key&#39;);
  echo $get;
?>
Copy after login

Execute the file and return the corresponding value:

[root@www bbs]# /usr/local/php/bin/php op_mem.php 
oldboy book
Copy after login

Related recommendations: php tutorial

The above is the detailed content of How to install memcache extension in php5.5. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)