Memcahe is a C/S architecture software, which has two parts: client and server;
For details about what memcache is and what it can do, just go to Baidu yourself;
Installation:
sudo apt-get update
sudo apt-get install memcached (The memcached version is 1.4.14)
When installing memcached, the system will automatically install the memcache client;
After the installation is successful, memcached will automatically start, but in case of emergency, it is recommended to start it manually. There are two ways:
① sudo /etc/init.d/memcached start
② sudo service memcached start
By the way, the last command:
start Start command;
restart Restart;
stop Stop running;
status Check the running status (after typing) Before using other commands, you can type this to check first);
Next install the PHP extension:
sudo apt-get install php5-memcache
Open the php.ini file and add
[memcache]
extension=memcache.so
in the last line My LAMP uses an integrated environment, xampp. When I restart the environment, an error will be reported because the memcache.so file cannot be found.
After installing it above, this file will be automatically generated in the directory /usr/lib/php5/20121212 , just copy a copy to the running directory of xampp,
It is as follows: cp /usr/lib/php5/20121212/memcache.so /opt/lampp/lib/php/extensions/no-debug-non- zts-20121212/
At this point, PHP can directly call memcache.
$doubi = new memcache();
...
Regarding PHP code examples, I have already introduced them in the brief introduction and use of Memcache under Windows, so I will not show them in detail here;
The above introduces Ubuntu configuration Memcached and PHP extensions, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.