Memcache under Windows install memcache installation under Linux

Source: Internet
Author: User
Tags crc32 php session

Memcache installation under Linux:

1. Download the Linux version of Memcache, note that Memcached uses Libevent for event-driven, so it is necessary to install Libevent first.

Official website: http://memcached.org/

2. Install the Pecl::memcache.

To install with the PECL command line tool:

PECL Install Memcache

Or install directly from the source:

Phpize./configuremakemake Install

Memcache installation under Windows:

1. Download Memcache's Windows stable version and unzip it under a disk, for example, in c:/memcached

2. Start → run → input cmd return → enter ' c:/memcached/memcached.exe-d install ' installation

3. Re-enter: ' c:/memcached/memcached.exe-d start ' starts.

Note: memcached will start automatically every time a service is turned on for Windows. This way the server side is already installed.

4. Download Php_memcache.dll, please find the corresponding PHP version of the file yourself

5. Add a line of ' Extension=php_memcache.dll ' to C:/winnt/php.ini

6. Restart Apache, then check the phpinfo, if there is memcache, then the installation is successful!

Attachment:

Memcache Download: http://download.csdn.net/detail/x171306523c/7863679

Php_memcache.dll Download: http://download.csdn.net/detail/x171306523c/7863693

Memcache Uninstall under Windows:

memcached-d stop

memcached-d Remove

SC delete "Memcached Server"

Basic Settings for memcached:

-P Listening Port
-L connected IP address, default is native
-D Start memcached service
-D Restart Restart memcached service
-D Stop|shutdown Close the running memcached service
-D Install memcached service
-d Uninstall Uninstall memcached service
-U Run as (only valid when running as root)
-m maximum memory usage, in megabytes. Default 64MB
-M running out of memory and returning an error 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 allocation space, key+value+flags default is 48
-H Display Help

Configuration in php.ini:

; Whether to transparently fail over to the other server when an error is encountered.
Memcache.allow_failover = On

; The maximum number of servers to try when accepting and sending data, only valid when Memcache.allow_failover is turned on.
Memcache.max_failover_attempts = 20

; The data will be transferred according to the block size set by this value. The smaller this value is, the more additional network traffic is required.
; If you find that unexplained speed decreases, you can try to increase this value to 32768.
Memcache.chunk_size = 8192

; The default TCP port to use when connecting to the memcached server.
Memcache.default_port = 11211

; Controls the policy that maps the key to the server. The default value of "standard" means using the previous version of the old hash policy.
; Set to "consistent" to allow the server to be added/removed from the connection pool without recalculating the mapping between key and server.
; memcache.hash_strategy = "standard"; Controls the hash function that maps the key to the server. The default value of "CRC32" uses the CRC32 algorithm, while "FNV" indicates the use of the FNV-1A algorithm.
; The fnv-1a is slightly lower than the CRC32, but the hash effect is better.
; memcache.hash_function = "CRC32"

Memcache can also be used as a memory module for session, see: Memcache PHP Session.save_handler.

http://hi.baidu.com/whzkinger/item/6cc85c5c01fbc011db16355f

Test code for Memcache:

<?PHP$memcache=NewMemcache; $memcache->connect (' localhost ', 11211) or die("Could Not Connect"); $version=$memcache-getversion (); Echo"Server S version:".$version." <br>/n "; $tmp _object=NewStdClass; $tmp _object->str_attr = ' Test '; $tmp _object->int_attr = 123; $memcache->set (' key ',$tmp _object,false, ten) or die("Failed to save data at the server")); EchoThe Store data in the cache (data would expire in seconds) <br>/n "; $get _result=$memcache->get (' key '); Echo"Data from the cache:<br>/n"; Var_dump($get _result);?>

Memcache under Windows install memcache installation under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.