PHP memcache is installed and working, but sporadic Class 'Memcache' not found error occurs-Collection of common programming errors
I am using the following:
- lighttpd/1.4.31 (ssl)
- lighttpd-fastcgi
- php 5.3.16
- php-pecl-memcache
- CentOS
I have memcached service running. phpinfo() reports that memcache extension is installed. My application is using memcache extension successfully, servicing thousands of queries. This is how I am initialising memcache:
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
However, after reading error log, I notice that right after I restarted lighttpd, and then once in a while log gets the following error:
2012-09-01 10:56:02: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Fatal error: Class ‘Memcache’ not found in /var/www/script.php on line 6
Line 6 being the following “$memcache = new Memcache;”.
Again, my application generally works, and thousands of requests using memcache are going OK, otherwise my application would not service a single request. It is only sometimes PHP is unable to find memcache class, but not everytime, which is what baffling me.
Any ideas what could be causing this issue? I have reinstalled PHP, checked my code thoroughly.
Update:
Seems like other default PHP classes are failing as well randomly during the run time:
2012-09-01 12:19:48: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Fatal error: Call to undefined function json_encode()