Proper optimization can, on the one hand, improve the efficiency of website source code execution, and on the other hand, reduce server pressure, killing two birds with one stone. Good VPS Gathering has also shared some tutorials on installing components in DirectAdmin (*hereinafter referred to as DA) to optimize the environment. Today, we will share the tutorial on installing the memcache component in DA.

Memcache is a high-performance distributed memory object caching system. By maintaining a unified huge hash table in the memory, it can be used to store data in various formats, including images, videos, files, and database retrieval results. . Simply put, the data is called into the memory and then read from the memory, thus greatly improving the reading speed.
Memcache is a project of danga. It was first served by LiveJournal. It was originally developed to speed up LiveJournal access and was later adopted by many large websites.
Memcached runs as a daemon on one or more servers and will receive client connections and operations at any time.
The above are all abstract and I like simplicity. Because it has benefits, it is installed. For example, if you want to enable object-cache caching for wordpress, you must support memcache. If you don’t install it, you won’t be able to play. The reason is simple and sufficient:)

First, let’s talk about the general environment. The server is a CentOS system, and DA uses PHP5.3.25 and MySQL5.5.32. The following is the compilation process.

1
2
3
4
5
6
7
wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar zxvf memcache-3.0.8.tgz
cd memcache-3.0.8
export PHP_PREFIX="/usr/local"
$PHP_PREFIX/php5/bin/phpize
./configure --with-php-config=$PHP_PREFIX/php5/bin/php-config
make & & make install

After compilation is completed, modify the php.ini file and add the memcache component.

1
2
3
[memcache]
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "memcache.so"

After everything is completed, reload Apache.

service httpd restart

Finally, check the memcache component in phpinfo.
memcache

something else

Finally, there are a few things you should pay attention to.
1. I have tried this tutorial under both PHP5.3.25 and PHP5.2.17. The difference that needs to be noted is the difference in extension_dir. For example, under PHP5.2.17 it is /usr/local/lib/php/extensions/no- debug-non-zts-20060613/;
2. When modifying php.ini, please put the memcache project on top of Zend;
3. This article only briefly describes the installation of memcache components on DA, you can also Adjust the default configuration, for example, by adding modifications to php.ini. For the simplest example, the default memcache.chunk_size is 32M. We can also adjust this by adding memcache.chunk_size=64M to php.ini. One setting.

postid
5486

Leave a Reply