Daniel Wilson
asked on
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/m emcache.in i in the "additional .ini files parsed"
what am I failing to do?
Thanks!
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/m
what am I failing to do?
Thanks!
ASKER
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.
But ... to get there, I am attempting to follow the example so I can do SOMETHING with memcache or memcached.
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
Either memcache or memcached is not installed or they are not enabled in php.ini
ASKER
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/g d.ini, /etc/php5/apache2/conf.d/m emcache.in i, /etc/php5/apache2/conf.d/m ysql.ini, /etc/php5/apache2/conf.d/m ysqli.ini, /etc/php5/apache2/conf.d/p do.ini, /etc/php5/apache2/conf.d/p do_mysql.i ni
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.*
ASKER
So is there a connecting piece I must install?
Here's what my system reports at the command-line:
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
Do the phpinfo as above and check it is listed.
ASKER
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?
Maybe I'm asking the wrong question.
What do I need to install so that I can use memcache or memcached from PHP?
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.
There is no point going any further til we know that.
ASKER
OK, it's not being loaded.
How do I get it to be loaded?
How do I get it to be loaded?
ASKER
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 ...
Is that from running
apt-get install memcached
apt-get install memcached
ASKER
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.
So apt-get reports memcached is at the newest version.
However ... ps-A | grep memcach returns nothing.
ASKER
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
http://php.net/manual/en/memcached.installation.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No doubt that's the right answer. Not working on Ubuntu 8.04.4 LTS. Server upgrade has been planned for a while ...
Yeah, thats quite an old version and really should have been updated 2 years ago.
ASKER
True.
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