PHP and memcache -- getting started

The PHP memcache example is not working for me.
http://php.net/manual/en/memcache.examples-overview.php

Fatal error: Class 'Memcache' not found

I suspect I need to require_once something.

I'm running PHP 5.2.4 and phpinfo() reports /etc/php5/apache2/conf.d/memcache.ini in the "additional .ini files parsed"

what am I failing to do?

Thanks!
LVL 32
Daniel WilsonAsked:
Who is Participating?
 
GaryCommented:
What exactly are you trying to do
In php there is Memcache and Memcached - you are probably trying to reference the wrong one - but there could be a dozen different reasons for the error
0
 
Daniel WilsonAuthor Commented:
I am attempting to cache a result set from MySql.

But ... to get there, I am attempting to follow the example so I can do SOMETHING with memcache or memcached.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
GaryCommented:
Do a phpinfo() to be sure what you are using

Either memcache or memcached is not installed or they are not enabled in php.ini
0
 
Daniel WilsonAuthor Commented:
The line in "additional.ini files" is the only reference to memcache in phpinfo()

Build Date       Mar 11 2013 14:04:25
Server API       Apache 2.0 Handler
Virtual Directory Support       disabled
Configuration File (php.ini) Path       /etc/php5/apache2
Loaded Configuration File       /etc/php5/apache2/php.ini
Scan this dir for additional .ini files       /etc/php5/apache2/conf.d
additional .ini files parsed       /etc/php5/apache2/conf.d/APC.ini, /etc/php5/apache2/conf.d/gd.ini, /etc/php5/apache2/conf.d/memcache.ini, /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini
PHP API       20041225
PHP Extension       20060613
Zend Extension       220060519
Debug Build       no
Thread Safety       disabled
Zend Memory Manager       enabled
IPv6 Support       enabled
Registered PHP Streams       zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps
Registered Stream Socket Transports       tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters       string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*
0
 
Daniel WilsonAuthor Commented:
So is there a connecting piece I must install?

Here's what my system reports at the command-line:
:~$ apt-cache search memcache
collectd - statistics collection and monitoring daemon
libcache-memcached-perl - Cache::Memcached - client library for memcached
libmemcache-dev - development headers for libmemcache C client API
libmemcache0 - C client API for memcached memory object caching system
php5-memcache - memcache extension module for PHP5
python-myghtyutils - Set of utility classes used by Myghty templating
memcached - A high-performance memory object caching system
0
 
GaryCommented:
Do the phpinfo as above and check it is listed.
0
 
Daniel WilsonAuthor Commented:
Check what is listed?  What I've been trying to explain is that the only listing of anything memcache is in the snippet I posted in the "additional .ini files parsed " section.

Maybe I'm asking the wrong question.

What do I need to install so that I can use memcache or memcached from PHP?
0
 
GaryCommented:
phpinfo() will list all loaded libraries, if it's not listed there then it is not being loaded
There is no point going any further til we know that.
0
 
Daniel WilsonAuthor Commented:
OK, it's not being loaded.

How do I get it to be loaded?
0
 
Daniel WilsonAuthor Commented:
Some pages recommend something with pecl.  But pecl is complaining about my PHP version.  I'm running PHP 5.2.4 on Ubuntu 8.  That may be part of the problem, but memcached has been around a LONG time ...
0
 
GaryCommented:
Is that from running

apt-get install memcached
0
 
Daniel WilsonAuthor Commented:
yes, I did install memcached in that way.

So apt-get reports memcached is at the newest version.

However ... ps-A | grep memcach returns nothing.
0
 
Daniel WilsonAuthor Commented:
For what it's worth, the top comment here has an example that fails similarly for me:
http://php.net/manual/en/memcached.installation.php
0
 
Daniel WilsonAuthor Commented:
No doubt that's the right answer.  Not working on Ubuntu 8.04.4 LTS.  Server upgrade has been planned for a while ...
0
 
GaryCommented:
Yeah, thats quite an old version and really should have been updated 2 years ago.
0
 
Daniel WilsonAuthor Commented:
True.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.