could you tell me, in what step u got the problem.
also in that tutorial they are just telling how to install memcahe demon.
you also need to install memcache support for you php.

anyways here is the detailed steps that you can use (I tested it on fedora,
hope it work well on CentOS too)

Let's get libevent which is required by Memcached:

------------------------------------------------------------------

wget 
http://monkey.org/~provos/libevent-1.3e.tar.gz<http://monkey.org/%7Eprovos/libevent-1.3e.tar.gz>

tar zxpfv libevent*

cd libevent*

./configure

make install

------------------------------------------------------------------

Now let's download the newest Memcached source (at time of writing this was
1.2.4)

------------------------------------------------------------------

wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz

tar zxpfv memcached*

cd memcached*

./configure

make install

------------------------------------------------------------------

Let's add Memcached user to run daemon as since we don't need it to run as
root privileges.

add a new user  "memcached".

We will start the server to use 48 megs of ram (-m 48), listen on ip
127.0.0.1 (-l 127.0.0.1) and run on port 11211 (-p 11211) as user memcached
(-u memcached)

./memcached -u memcached -d -m 48 -l 127.0.0.1 -p 11211

If you get the following error (if you are not that lucky )

./memcached: error while loading shared libraries: libevent-1.3e.so.1:
cannot open shared object file: No such file or directory

You can fix this by simply doing this:
ln -s /usr/local/lib/libevent-1.3e.so.1 /lib64/    (for 64bit OS)
or
ln -s /usr/local/lib/libevent-1.3e.so.1 /lib/    (for 32bit OS)

That is all there is to it. You can see if daemon is running by telneting to
the port.

-------------------------
# PHP-Memcache Client Install
-------------------------

# Download the extension module
yum install php-pecl-memcache.i386

# Edit /etc/php.d/memcache.ini and uncomment the following line by removing
the semi-colon
extension=memcache.so

# Restart apache
/sbin/service httpd restart

-------------------------
# Test Install
-------------------------

# Create a file 'memcache_test.php' in your webroot and paste the following:

<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data
at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
?>

# Test to see if the file renders in your browser

Regards,

On Tue, Jan 27, 2009 at 12:41 PM, veera narayana <[email protected]> wrote:

> Hi ,
>    Thanks for your quick reply.I am using centOS.
> I followed the steps described in
> http://www.howtoforge.com/php_memcache_centos5.0.But i was not successful.
> Thanks
>
>
> On Tue, Jan 27, 2009 at 1:41 AM, Abhinav Gupta <[email protected]>wrote:
>
>> Hi Narayna,
>>
>> you need to install memcache demon and a php-memcache client API to run
>> your code.
>> tell me the OS you are using so that i can help you more.
>>
>> Regards,
>>
>>
>> On Tue, Jan 27, 2009 at 11:03 AM, veera narayana <[email protected]>wrote:
>>
>>> Hi ,
>>>   I am working on PHP. I saw about memcached through google search and i
>>> really impressed with the way it is working.
>>>
>>> can any one please suggest whether it is work with PHP and do i need to
>>> install any plugins to work with memcached.
>>>
>>> Please refer is there any tutorials or examples for memchached.
>>>
>>> thanks & regards
>>> Narayana
>>>
>>
>>
>>
>> --
>> ============================================================================================
>>
>> "The future belongs to those who believe in the beauty of their dreams"
>>
>> =============================================================================================
>> Abhinav Gupta
>> Software Engineer @99acres.com
>>
>
>


-- 
============================================================================================

"The future belongs to those who believe in the beauty of their dreams"
=============================================================================================
Abhinav Gupta
Software Engineer @99acres.com

Reply via email to