Memcached configuration and install PHP extension for windows 1. download memcached server 2.8.0: XXmemcached.exe-dinstall & nbsp; install 3.small: XXmemcached.exe-dstart. 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: Memcached configuration and 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'));