Recently, I was installing memcache libraries and the memcache extension for PHP on one of our Linux boxes. Unfortunately when I tried to run a sample code just to test if everything was successful with the installation, I got an error instead which say Memcache not found. I digged for a couple of days looking for solutions to my problem and Googling it didn’t even help me at all.

Without losing my patience, I tried reading the error logs of httpd(usually in /var/log/httpd/error_log) and somewhere it showed this message,

PHP Warning:  PHP Startup: Unable to load dynamic library ‘./memcache.so’ – ./memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0

After that, I tried to check the php.ini (usually in /usr/local/lib/php.ini) and made sure that the extension=memcache.so was there, and on the extension_dir property, it looked like this,

extension_dir=”./”

seeing that, I tried a lucky guess and I changed it to a full path instead,

extension_dir = “/usr/local/lib/”

Next, I simply restarted httpd with,

service httpd restart

Then I again checked the httpd error_log and I noticed that the error is gone! With that information, I immediately tried the test PHP code again and Voila! My memcache extension is running perfectly!

Hope this helps.

JM Aliling

pixelstats trackingpixel

Leave a Reply