memcached Configuring Installation/php Extensions
Windows Edition
1. Download memcached Server Side
2. Cmd:xx\memcached.exe-d Install
3. cmd:xx\memcached.exe-d start.
PS: memcached will start automatically every time a service is turned on for Windows.
Additional Command parameters:
Reference
-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 allocated space, key+value+flags default is 48
-H Display Help
Modify the memcache port number
Reference
In the hkey_local_machine\system\currentcontrolset\services\memcached Server
Here is a string entry for the ImagePath string, which is exactly the execution path of the service.
Double-click the string, add-M 45-p 12345 (using 45M memory, 12345 ports), and then start the service
Linux Edition
php memcached Extension installation
First install the PHP memcached extension
PHP's Memcache extension relies 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
memcached Installation
Memcached installation requires libevent support download
memcached download
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 '));