Thanks for your valuable answer. I was totally fed-up with this. After
getting your answer I tried to install memcache library and made
modification in the ini file. Now it is working fine. My following
code is working fine.

[syntax=php]<?php
error_reporting(-1);
ini_set('display_errors', true);
    $memcache = new Memcache();
    //$memcache->connect("10.1.11.33",11211) or die ("Could not
connect");
        $memcache->addServer("10.1.11.33",11211, 33);
        echo "version = " . print_r($memcache->getVersion());

        if ( ! extension_loaded('memcache')) {
            throw new Doctrine_Cache_Exception('In order to use
Memcache driver, the memcache extension must be loaded.');
    }
?>[/syntax]

My actual aim is to implement memcache in my restful apis. I am using
php and symfony/doctrine as my framework. For your information about
caching in doctrine (it is an ORM) please refer
http://www.doctrine-project.org/documentation/manual/1_1/en/caching

And from symfony I used resultcaching. It is also working. I verified
by modifying the content in the database and the modified content is
not loading in the result. But after the life span the changed content
is loading.

Here is the code snippet which I used to load the cache driver in the
symfony framwork.

 [syntax=php]   public function configureDoctrine(Doctrine_Manager
$manager) {
        $servers = array(
            'host' => '10.1.11.33',
            'port' => 11211,
            'persistent' => true
        );
        $cacheDriver = new Doctrine_Cache_Memcache(array(
            'servers' => $servers,
            'compression' => false
            )
        );
        //enable Doctrine cache
        $manager = Doctrine_Manager::getInstance();
        $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE,
$cacheDriver);
        $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN,
900);
    }[/syntax]

But I have one more issue. When I tried to clear the cache it is
giving me the an error [quote]In order to use Memcache driver, the
memcache extension must be loaded.[/quote]

But in the sample code this error is not returning.

Do u have any solutions for this?

regards
Shihab


On Jan 24, 8:53 pm, Brian Moon <[email protected]> wrote:
> It's right in front of your eyes. =)
>
> You have loaded pecl/memcached, so your object name should be Memcached();
>
> On 1/23/11 11:42 PM, Shihab KB wrote:
>
>
>
> > Hi,
>
> > I am trying to install memcached in Ubuntu 10.04. I have followed the
> > instructions from the site
> >http://stevelove.org/2009/09/30/how-to-install-php-memcached-on-an-ub...
> > to installation.
>
> > After installation I can access memcached thru telnet and I executed
> > stats command. It is working properly. But when I am trying to connect
> > thru php it is not working. Following is my php file.
>
> > [code]
> > <?php
> >      $memcache = new Memcache();
> > ?>
> > [/code]
>
> > It return the error “Fatal error: Class 'Memcache' not found in /home/
> > hysanew/web/memcachetest.php on line 5”.
>
> > In my php.ini file and memcached.ini I have added “extension =
> > memcached.so”.
>
> > But when I restart the apache server it log an error in the error log
> > as “PHP warning : Module ‘memcached’ already loaded in Unknown on line
> > 0.
>
> > Can somebody help me regarding this issue?
>
> > Regards
> > Shihab
>
> --
>
> Brian.
> --------http://brian.moonspot.net/

Reply via email to