Home > php教程 > php手册 > body text

memcache/memcached installation tutorial and application of Tinkphp3.2

WBOY
Release: 2016-08-20 08:48:17
Original
1086 people have browsed it

I plan to fully apply memcached technology in my new program. It is easy to understand that memcached is a memory cache, but why is there still memcache?
In fact, it is very simple. Memcache is an extension of PHP, used for PHP to manage memcached, php-memcache.dll.
If you install memcached without installing extensions, then php cannot control memcached, but there is no problem in using the command line
If the memcache extension is installed but the memcached service is not installed, then this cannot be used
Only if the memcached service and memcache extension are installed at the same time
1. Install the memcache php extension

1. php_memcache.dll Download:
Download address: php_memcache.zip http://www.2cto.com/uploadfile/2012/0713/20120713110240777.zip
(The extension here must be downloaded the same as your computer, that is to say, if it is 32-bit, download the 32-bit extension. The download cannot be loaded)
2. Put php_memcache.dll into the ext directory of php:
For example: D:WampServerbinphpphp5.5.1extphp_memcache.dll
3. Open the php.ini file:
The location of my php.ini: D:WampServerbinphpphp5.5.1php.ini
4. Add a line to php.ini:
extension=php_memcache.dll
5. Restart Wampserver’s apache service
2. Install memcached

1. Memcached-win64 Download:
a. Download the latest version: http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available
b. Direct download: memcached-win64-1.4.4-14.zip
http://www.2cto.com/uploadfile/2012/0713/20120713110308123.zip2. Unzip and put it under a certain disk, such as:

D:WampServerbinmemcachedmemcached.exe
3. Enter the following command in the terminal (i.e. cmd command interface) to install the windows service:
(Note here, the cmd command requires administrator privileges to run, otherwise you will not be able to install it)
D:WampServerbinmemcached>memcached.exe -d install
4. Enter the following command to start:
D:WampServerbinmemcached>memcached.exe -d start
OK~~You’re done
Open the phpinfo() page and you will see:
memcache/memcached installation tutorial and application of Tinkphp3.2
If you don't see it, it means your expansion was unsuccessful. If there is no success, you should check whether the extended version is correct. First, it must correspond to the PHP version. For example, mine is 5.5.1, then you can download 5.5. Second, it must correspond to the computer. For example, mine is 64-bit, then you should choose 64-bit.
Applied to Thinkphp3.2

1. Configure in config.php
'DATA_CACHE_TYPE' => 'Memcache',
'MEMCACHED_HOST' => '127.0.0.1',
'MEMCACHED_PORT' => '11211',
2. In the program
S("liao","successful");
var_dump(S("liao"));
You will see a successful printout.


For more details, please check: http://www.liaoxiansheng.cn/?p=450

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!