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

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

am 26.10.2009 16:45:41 von Tom Barrett

Hello

I have installed:
=A0- libevent
=A0- libmemcached (http://tangent.org/552/libmemcached.html)
=A0- Done a PECL installation (pecl download memcached, phpize &&
../configure && make)
=A0- memcached

> cat /etc/php.d/memcached.ini
; Memcached default settings
extension=3Dmemcache.so

> ls -1 =A0/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
$memcache =3D new Memcache;
print_r($memcache);
?>

/var/www/php_fcgi_memcache> php memcache.php
PHP Fatal error: =A0Class '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

Re: (nginx) fcgi+PHP+memcache on RedHat: Class "Memcache" not

am 26.10.2009 16:49:26 von Eddie Drapkin

On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett 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=3Dmemcache.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
> > $memcache =3D 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!

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

Re: (nginx) fcgi+PHP+memcache on RedHat: Class "Memcache" not

am 26.10.2009 16:59:00 von Tom Barrett

2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett wrote=
:
>> Hello
>>
>> I have installed:
>> =A0- libevent
>> =A0- libmemcached (http://tangent.org/552/libmemcached.html)
>> =A0- Done a PECL installation (pecl download memcached, phpize &&
>> ./configure && make)
>> =A0- memcached
>>
>>> cat /etc/php.d/memcached.ini
>> ; Memcached default settings
>> extension=3Dmemcache.so
>>
>>> ls -1 =A0/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
>> >> $memcache =3D new Memcache;
>> print_r($memcache);
>> ?>
>>
>> /var/www/php_fcgi_memcache> php memcache.php
>> PHP Fatal error: =A0Class '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
$memcache =3D new Memcached;
print_r($memcache);
?>

> php memcached.php
Memcached Object
(
)

I have used the $m=3Dnew Memcache; syntax on another server, which works fi=
ne.

Or have I mixed up my libraries somehow?

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

Re: (nginx) fcgi+PHP+memcache on RedHat: Class "Memcache" not

am 26.10.2009 17:04:16 von Eddie Drapkin

On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett wrote:
> 2009/10/26 Eddie Drapkin :
>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett wrot=
e:
>>> 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=3Dmemcache.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
>>> >>> $memcache =3D 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
> > $memcache =3D new Memcached;
> print_r($memcache);
> ?>
>
>> php memcached.php
> Memcached Object
> (
> )
>
> I have used the $m=3Dnew 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

Re: (nginx) fcgi+PHP+memcache on RedHat: Class "Memcache" not

am 26.10.2009 17:22:53 von Tom Barrett

2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett wrote=
:
>> 2009/10/26 Eddie Drapkin :
>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett wro=
te:
>>>> Hello
>>>>
>>>> I have installed:
>>>> =A0- libevent
>>>> =A0- libmemcached (http://tangent.org/552/libmemcached.html)
>>>> =A0- Done a PECL installation (pecl download memcached, phpize &&
>>>> ./configure && make)
>>>> =A0- memcached
>>>>
>>>>> cat /etc/php.d/memcached.ini
>>>> ; Memcached default settings
>>>> extension=3Dmemcache.so
>>>>
>>>>> ls -1 =A0/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
>>>> >>>> $memcache =3D new Memcache;
>>>> print_r($memcache);
>>>> ?>
>>>>
>>>> /var/www/php_fcgi_memcache> php memcache.php
>>>> PHP Fatal error: =A0Class '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
>> >> $memcache =3D new Memcached;
>> print_r($memcache);
>> ?>
>>
>>> php memcached.php
>> Memcached Object
>> (
>> )
>>
>> I have used the $m=3Dnew 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. =A0Memcached is the newer (imo better) extension written by
> Andrei (at digg) to use libmemcached. =A0Memcache 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. =A0They have slightly different APIs, so I'd make sure you're
> aware of which one you're using. =A0:)

Thanks

Any chance you could show me the way?

This is how I installed the PECL extension:

> pecl download memcached
> tar zxf memcached-1.0.0.tgz
> cd memcached-1.0.0
> phpize
> ./configure
> make
> make install

Does that look like the right one? Did I miss something?

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

Re: (nginx) fcgi+PHP+memcache on RedHat: Class "Memcache" not

am 26.10.2009 17:25:15 von Eddie Drapkin

On Mon, Oct 26, 2009 at 12:22 PM, Tom Barrett wrote:
> 2009/10/26 Eddie Drapkin :
>> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett wrot=
e:
>>> 2009/10/26 Eddie Drapkin :
>>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett wr=
ote:
>>>>> 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=3Dmemcache.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
>>>>> >>>>> $memcache =3D 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
>>> >>> $memcache =3D new Memcached;
>>> print_r($memcache);
>>> ?>
>>>
>>>> php memcached.php
>>> Memcached Object
>>> (
>>> )
>>>
>>> I have used the $m=3Dnew Memcache; syntax on another server, which work=
s 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, entir=
ely
>> 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'r=
e
>> aware of which one you're using.  :)
>
> Thanks
>
> Any chance you could show me the way?
>
> This is how I installed the PECL extension:
>
>> pecl download memcached
>> tar zxf memcached-1.0.0.tgz
>> cd memcached-1.0.0
>> phpize
>> ./configure
>> make
>> make install
>
> Does that look like the right one? Did I miss something?
>

That'll install the Memcached extension, which is the one I'd usually
recommend and the one that I use. I don't see anythign wrong with
using that one or that way of installing it, but I was just saying
that the method names and parameters are different from the older
extension and to just be aware of that.

Old extension: http://us2.php.net/manual/en/book.memcache.php
New extension: http://us2.php.net/manual/en/book.memcached.php

The naming confusion is unnecessary but it exists so there's not
really too much you can do about it :P

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