Re: (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett <tom@xxxxxxxxxxxxxxx> wrote:
> 2009/10/26 Eddie Drapkin <oorza2k5@xxxxxxxxx>:
>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <tom@xxxxxxxxxxxxxxx> wrote:
>>> Hello
>>>
>>> I have installed:
>>>  - libevent
>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>> ./configure && make)
>>>  - memcached
>>>
>>>> cat /etc/php.d/memcached.ini
>>> ; Memcached default settings
>>> extension=memcache.so
>>>
>>>> ls -1  /usr/lib64/php/modules/memcache*
>>> /usr/lib64/php/modules/memcached.so
>>> /usr/lib64/php/modules/memcache.so
>>>
>>>> memcached -h
>>> memcached 1.2.6
>>> ...
>>>
>>>> php -v
>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>> Copyright (c) 1997-2006 The PHP Group
>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>
>>>
>>> /var/www/php_fcgi_memcache> cat memcache.php
>>> <?php
>>> $memcache = new Memcache;
>>> print_r($memcache);
>>> ?>
>>>
>>> /var/www/php_fcgi_memcache> php memcache.php
>>> PHP Fatal error:  Class 'Memcache' not found in
>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>
>>> Memcached is working fine (being use by Perl quite happily).
>>>
>>> PHP/FCGI is working OK and phpinfo() shows:
>>> memcached support enabled
>>> Version 1.0.0
>>> libmemcached version 0.34
>>> Session support yes
>>>
>>> Any pointers in the right direction would so very much appreciated.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Try instantiating a Memcached instance, not a Memcache instance.
>> They're two different PECL extensions!
>
> Hi
>
> That just auto-instantiates an empty object?
>
>> cat memcached.php
> <?php
> $memcache = new Memcached;
> print_r($memcache);
> ?>
>
>> php memcached.php
> Memcached Object
> (
> )
>
> I have used the $m=new Memcache; syntax on another server, which works fine.
>
> Or have I mixed up my libraries somehow?
>

They're actually two different classes from two different PECL
extensions.  Memcached is the newer (imo better) extension written by
Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
custom (no external deps) PECL extension that's been around forever.
So, I'm guessing you have Memcache on one machine and Memcached on
another.  They have slightly different APIs, so I'd make sure you're
aware of which one you're using.  :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux