I checked some installation methods on the Internet and tried it. Ubuntu does not support XAMPP. So start to try a new installation method: first install memcache and php5memcache module sudoapt-getinstallmemcachedphp5-memcache copy the generated file to the location where the LAMPP is stored: cp/usr/lib/php5/20090626 + lfs/memcache. so/opt/lampp/lib/
I checked some installation methods on the Internet and tried it. Ubuntu does not support XAMPP.
Then try the new installation method:
First install memcache and php5 memcache module sudo apt-get install memcached php5-memcache
Copy the generated file to the location where LAMPP is stored:
Cp/usr/lib/php5/20090626 + lfs/memcache. so/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/memcache. so
Configure/opt/lampp/etc/php. ini
Extension = memcache. so
[Memcache]
Memcache. dbpath = "/var/lib/memcache"
Memcache. maxreclevel = 0
Memcache. maxfiles = 0
Memcache. archivememlim = 0
Memcache. maxfilesize = 0
Memcache. maxratio = 0
Restart LAMPP
PHPINFO:
Memcache
Memcache support |
Enabled |
Version |
3.0.4 |
Revision |
$ Revision: 1.83.2.36 $ |
Directive |
Local Value |
Master Value |
Memcache. allow_failover |
1 |
1 |
Memcache. chunk_size |
32768 |
32768 |
Memcache. compress_threshold |
20000 |
20000 |
Memcache. default_port |
11211 |
11211 |
Memcache. hash_function |
Crc32 |
Crc32 |
Memcache. hash_strategy |
Consistent |
Consistent |
Memcache. lock_timeout |
15 |
15 |
Memcache. max_failover_attempts |
20 |
20 |
Memcache. protocol |
Ascii |
Ascii |
Memcache. redundancy |
1 |
1 |
Memcache. session_redundancy |
2 |
2 |
Run the memcache memory, port, and running user sudo memcached-d-m 50-p 11211-u root
Parameter description-m specifies the number of MB of cache space used;
-P: Specifies the port to be listened on;
-U specifies which user to run here is only a test case. To ensure security, you can also set other users to run the Memcache configuration file in/etc/php5/conf. d/memcache. ini is used for testing and is not configured.
Code to test whether memcache is successful:
$ Mem-> connect ("127.0.0.1", 11211 );
$ Mem-> set ('key', 'This is a memcached test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
?>