PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : آموزش کامل نصب MemCache



P-CO
April 6th, 2009, 00:12
با سلام، این هم از آموزش. امیدوارم موثر واقع بشه...



Make sure before you start tying to install memcache that you have gcc (# yum install gcc) and libevent-devel (# yum install libevent-devel) installed.

[root@server1 ~]# wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
[root@server1 ~]# tar -zxvf memcached-1.2.6.tar.gz
[root@server1 ~]# cd memcached-1.2.6
[root@server1 memcached-1.2.6]# ./configure
[root@server1 memcached-1.2.6]# make
[root@server1 memcached-1.2.6]# make install

Now if you are lazy like me and don’t want to have to remember what the memcached flags are every time you start it I would recommend using an init.d script. I recommend using the one located at http://www.dev411.com/wiki/Memcached_startup_files_for_Red_Hat_(RHEL). To install the init.d script on your server you need to place the start-memcached perl script in /usr/local/bin/start-memcached. Make sure you have given this file chmod 755 and is chown root:root. Then you must place the memcached-init into /etc/init.d/memcached, make sure this script has the same permissions as the previous file. Finally create the configuration file /etc/memcached.conf, you can place any options that you want ran by the memcached binary in this file. I use the following in my file.

# /etc/memcached.conf

# user to run memcached as
-u apache

# we want to run memcached as a daemon
-d

# amount of RAM we want to dedicate to memcached in MB
-m 512

# interface to listen to for memcached connections on
-l 127.0.0.1

# port to listen for memcached connections on
-p 11211

Starting Memcached

Now you should be able to start and stop memcached quickly by using the following commands.

[root@server1 ~]# /sbin/service memcached start
[root@server1 ~]# /sbin/service memcached stop

If you did not install the init.d script then you can start memcached with the following command.

[root@server1 ~]# memcached -d -u apache -m 512 -l 127.0.0.1 -p 11211

Installing the Memcache PHP extension

Installing the memcache php module from source is fairly strait forward, it is just like installing any other php module. Please note that you must have zlib-devel and php-devel packages installed.


[root@server1 ~]# wget http://pecl.php.net/get/memcache
[root@server1 ~]# tar -zxvf memcache-3.0.2.tgz
[root@server1 ~]# cd memcache-3.0.2
[root@server1 memcache-3.0.2]# phpize
[root@server1 memcache-3.0.2]# ./configure
[root@server1 memcache-3.0.2]# make
[root@server1 memcache-3.0.2]# make install


Now we need to tell php to include our memcache extension when it starts up. We do this by putting the following configuration data in /etc/php.d/memcache.ini

; /etc/php.d/memcache.ini

; include the memcache php extension
extension=memcache.so

You will be able to verify that the memcache php extension has been installed by typing # php -m and looking for memcache in the php extension list.

sodahost
April 6th, 2009, 01:30
مزایای این کار رو می تونید کامل بگید ؟