Could not install Memcached back?

fwh

Administrator
Staff Member
Joined
Dec 8, 2012
Messages
773
Points
63
Hello,

Before upgraded to PHP7 on my VPS, I used PHP 5.6 and installed Memcached successfully on my VPS and used it for my websites.

But, after installed PHP7, I got this error on the VPS with PHP7

# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0



I downgraded PHP 7 back to PHP 5.6

But it is still showing same error when checking with php -v

Code:
[root@serverh ~]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP 5.6.25 (cli) (built: Sep 13 2016 01:27:52)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
the problem is, when I add memcache module into PHP

Code:
extension=memcache.so
to

Code:
/usr/local/lib/php.ini

then it didn't work like before.

It showed error when checking with php -v

Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0
and memcache module doesn't appear when checking with phpinfo() any more.

Does any one know how to solve this problem?


Thanks in advance!
 

fwh

Administrator
Staff Member
Joined
Dec 8, 2012
Messages
773
Points
63
Yes you just have to remove the file memcache.ini from /etc/php/fpm/5.6 or 7/modules
It's because php try to load an extension which doesn't exist
Thanks but there is not memcache.ini in /etc/php/fpm/5.6 or 7, also doesn't have these folders on my VPS

I also tried all ways from all sites by searching on Google but could not fix this problem.

After 15 minutes asked this question, I could find the solution to fix the problem by myself and I could add memcache.so to php.ini without any problems.

and memcache module could add to PHP and it working like before (when I4 used php 5.6)

The solution is very simple

when I tried to reinstall memcache php then it alerted this

Code:
[root@server ~]# pecl install memcache
pecl/memcache is already installed and is the same as the released version 2.2.7
install failed
and I could not install memcache php again

so I tried to uninstall memcache php first

Code:
pecl install memcache
After uninstall memcache, I can install memcache php back with the command

pecl install memcache
And adding add extension=memcache.so to /usr/local/lib/php.ini as normally

Restart web server

Code:
Service httpd restart
And the problem is SOLVED!

I hope someone can find this and fix the problem if they have same problem as me.

Hope it helps!
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
Sorry it's the folder structure for Debian/Ubuntu, not for Centos.
But that's because for php5.6 you can install it from the packages :

php-memcached - memcached extension module for PHP, uses libmemcached
php-memcache - memcache extension module for PHP

And for php7 there is no package yet, so you have to use PECL extension for that purpose.
 
Older Threads
Replies
1
Views
2,188
Replies
3
Views
2,130
Replies
5
Views
7,318
Newer Threads
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top