Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install memcache for php

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install memcache in php". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install memcache in php.

1. Download memcached software

32-bit download address: memcached-win32-1.4.4-14.zip (direct download) download page

64-bit download address: memcached-win64-1.4.4-14.zip (direct download) download page:

I use a wamp,64-bit computer. Download the memcached server-side software package.

Extract the package to the specified directory. I chose D:\ memcached

2. Install memcached

Run cmd.exe as an administrator and go to the folder where memcached is located. And install memcached.

There is no prompt after installation.

3. Start the memcached service

Continue to execute the open memcached command in cmd.exe:

Memcached.exe-d start

Then go to the task manager to see if the memcached service has been started.

4. Setting basic parameters of memcached

-Port on which p listens

-l IP address of the connection. Default is local.

-d start starts the memcached service

-d restart restarts memcached service

-d stop | shutdown shuts down the running memcached service

-d install install memcached service

-d uninstall uninstall the memcached service

-u runs as (valid only when running as root)

-m maximum memory usage, in MB. Default 64MB

-M returns an error when memory is exhausted instead of deleting an item

-c maximum number of simultaneous connections. Default is 1024.

-f block size growth factor, default is 1.25

-n minimum allocated space. Key+value+flags defaults to 48.

-h display help

5. Stop and uninstall commands of memcached

1 D:\ memcached > memcached.exe-d stop

2 D:\ memcached > memcached.exe-d uninstall

Installation of PHP memcache extensions (windows version)

1. Download the memcache.dll extension

Download address: http://pecl.php.net/package/memcache/3.0.8/windows

Download Note: select the version that matches your environment and the thread-safe version.

The wamp2.5 php version I use locally is 5.5 Windows 64-bit, so I downloaded 5.5 Thread Safe (TS) x64.

2. After the download is completed, decompress the package as shown in the following figure.

Copy the php_memcache.dll extension file into the extension directory of php, for example (D:\ wamp\ bin\ php\ php5.5.12\ ext)

3. Modify php.ini file

Open the php.ini file of php (my address is: d:\ wamp\ bin\ apache\ apache2.4.9\ bin\ php.ini)

Add a line of code:

Extension=php_memcache.dll

As shown in the figure:

Note: it must be on a new line and cannot be preceded by a semicolon. The semicolon represents the comment point and cannot be used.

After saving, restart the server (apache or nginx or iis) and I will restart wamp directly.

Browser input: http://localhost/?phpinfo=1 can see that the memcache extension has been loaded. As shown in the picture

Finally, test whether the memcache feature is available

Create a new php file test.php

$memcache = new Memcache

$memcache- > connect ('127.0.0.1) or die (' shit')

$memcache- > set ('key','hello Memcachetti')

$out = $memcache- > get ('key')

Echo $out

Then access the file through the browser, and as a result, you can see the input:

Hello memcache!

At this point, I believe you have a deeper understanding of "php how to install memcache". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report