Memcached with installation/PHP extension

Source: Internet
Author: User
Tags php memcached
Memcached configuration and installation/PHP extension for windows 1. download memcached server 2.small: XX \ memcached.exe-dinstall & nbsp; install 3.small: XX \ memcached.exe-dstart to start. PS: Memcached configuration installation/PHP extension
Windows
1. download the memcached server
2. CMD: XX \ memcached.exe-d install installation
3. CMD: XX \ memcached.exe-d start.
PS: In the future, memcached will be used as a windows service and will be automatically started every time it is started.
Other command parameters:
Reference
-P listening port
-L connected IP address. the default value is local
-D start: start the memcached service.
-D restart: restart the memcached service.
-D stop | shutdown the running memcached service
-D install the memcached service
-D uninstall memcached service
-U runs as the identity (only valid when running as root)
-MB maximum memory usage, in MB. The default value is 64 MB.
-An error is returned when M memory is used up, instead of deleting items.
-C: maximum number of simultaneous connections. the default value is 1024.
-F block size growth factor, default value: 1.25
-N: Minimum allocation space. the default value of key + value + flags is 48.
-H Show Help


Modify memcache port number
Reference
In the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ memcached Server
The following shows a string of ImagePath, which is exactly the string of the service execution path,
Double-click the string, add-m 45-p 12345 (use 45 m memory, 12345 as the Port) to the end, and then start the service.


Linux
PHP memcached extension installation
First install the memcached extension of PHP
Php's memcache extension depends on libmemcached download
Php memcached extension download

Reference tar-zxvf libmemcached-1.0.4.tar.gz
Cd libmemcached-1.0.4
./Configure
Make & make install


Tar-xf memcached-2.0.1.tgz
Cd memcached-2.0.1

/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make & make install


Install Memcached
The memcached installation requires libevent to support downloading.
Download memcached

Reference tar-xzf libevent-1.3a.tar.gz
Cd libevent-1.3a
./Configure -- prefix =/usr
Make
Make install
Cd ..
Tar-xzf memcached-1.2.1.tar.gz
Cd memcached-1.2.1
./Configure -- prefix =/usr/local/
Make
Make install

Test

Start the service:
Reference memcached-d-m 5120-u root-l 192.168.11.11-p 11211-c 65535-P/var/run/memcached. pid
# Memcached-d-m 5120-u root-l 127.0.0.1-p 11211-c 65535-P/var/run/memcached. pid

PHP code
 addServer('127.0.0.1', 11211); $m->setOption(Memcached::OPT_COMPRESSION, false); $m->set('foo', 'abc'); $m->append('foo', 'def'); var_dump($m->get('foo'));

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.