Learn about Centmin Mod LEMP Stack today
Register Now

PHP-FPM Upgraded to PHP 7 and memcached.so throwing errors

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by jeffwidman, Mar 12, 2016.

  1. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    I'm upgrading two servers from PHP 5.6 to PHP 7 and for some reason I can't get the memcached.so/memcached.ini extension to work.

    I know memcache doesn't work, but I thought memcached (with the 'd' at the end) does work on PHP 7?

    My upgrade steps:
    1. Updated to latest Centmin.sh from github
    2. Ran option #5 to upgrade PHP--entered 7.0.4
    3. `nprestart` throws:
    Code:
    Starting php-fpm [12-Mar-2016 06:30:17] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
    
    I got the same error for igbinary and memcache, but I just removed the ini files as they are known to not currently work with PHP 7.

    4. Then, just in case, I reinstalled memcache using centminmod option #10
    5. Since error continued to show up, I rebooted the box, then reinstalled memcache, then php, then rebooted the box again, and throwout the error continues to appear.

    Is there a problem with the latest memcached.ini file and PHP 7?

    This is actually happening on two servers, and each has slightly different output of `php --ri memcached`:

    server 1:
    Code:
    [root@kat centminmod]# php --ri memcached
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
    Extension 'memcached' not present.
    
    server 2:
    Code:
    [root@host1 ~]# php -ri memcache
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1
    
     
    Last edited: Mar 12, 2016
    • Informative Informative x 1
  2. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod Github master branch is 123.08stable and that doesn't support PHP 7 memcache/memcached PHP extensions fully. Only Centmin Mod 123.09beta01 branch specifically supports PHP 7 for those extensions as the memcache/memcached PHP extensions are sourced from beta/experimental branches of their respective github repos still.

    Also 123.09beta01 has quite a few changes to support gitlab fall back mirrors for github past few days Commits · centminmod/centminmod · GitHub But haven't touched memcache/memcached PHP extensions yet for fallback. The end goal is to have Centmin Mod 123.09beta01 fully working with gitlab repo mirror fallback from github Install Centmin Mod LEMP stack via Gitlab.com Mirror | Centmin Mod Community :)
     
  3. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    Yeah, but I successfully upgraded a third server to PHP 7 about a month ago (before I realized NewRelic agent didn't support PHP 7). I don't remember switching away from the master branch on github. I double-checked `.bash_history` on that server, and I never switched away from the master branch on github, yet memcached + php 7 are happily playing nice together on that server.

    Is there something I missed somewhere to only upgrade to the new version of memcache without upgrading anything else to 123.09 beta1? I searched, but not finding a forum post with instructions.
     
    Last edited: Mar 12, 2016
  4. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    FYI newrelic announced official PHP 7 support with their latest newrelic-php agent unfortunately it causes segfaults heh PHP-FPM - newrelic-php extension causing segfault errors in PHP-FPM | Centmin Mod Community so nearly there.

    As to memcache and php 7 never worked on 123.08stable/master branch as the sourced memcache git repo doesn't support php 7. I had to use a separate github repo for memcache php 7 support at GitHub - websupport-sk/pecl-memcache (gitlab mirror at centminmod-github-mirror / pecl-memcache · GitLab

    However, looks like memcache + php 7 is broken now too on 123.09beta01 - it's actually a bug in 123.09beta01 which i have just committed the fix for
    Code (Text):
    fpmrestart
    Gracefully shutting down php-fpm . done
    Starting php-fpm [12-Mar-2016 07:08:21] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcache.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0

    committed fix bug fix for memcache php extension for php 7 on 123.09beta01 · centminmod/centminmod@2319acb · GitHub

    Code (Text):
    php -v
    PHP 7.0.4 (cli) (built: Mar  3 2016 18:46:43) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
        with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    

    Code (Text):
    php --ri memcache
    
    memcache
    
    memcache support => enabled
    Version => 3.0.9-dev
    Revision => $Revision$
    
    Directive => Local Value => Master Value
    memcache.allow_failover => 1 => 1
    memcache.max_failover_attempts => 20 => 20
    memcache.default_port => 11211 => 11211
    memcache.chunk_size => 32768 => 32768
    memcache.protocol => ascii => ascii
    memcache.hash_strategy => consistent => consistent
    memcache.hash_function => crc32 => crc32
    memcache.redundancy => 1 => 1
    memcache.session_redundancy => 2 => 2
    memcache.compress_threshold => 20000 => 20000
    memcache.lock_timeout => 15 => 15
    

    Code (Text):
    php --ri memcached
    
    memcached
    
    memcached support => enabled
    Version => 3.0.0b1
    libmemcached version => 1.0.16
    SASL support => yes
    Session support => yes
    igbinary support => no
    json support => yes
    msgpack support => no
    
    Directive => Local Value => Master Value
    memcached.sess_locking => 1 => 1
    memcached.sess_lock_wait_min => 1000 => 1000
    memcached.sess_lock_wait_max => 2000 => 2000
    memcached.sess_lock_retries => 5 => 5
    memcached.sess_lock_expire => 0 => 0
    memcached.sess_binary_protocol => 1 => 1
    memcached.sess_consistent_hash => 0 => 0
    memcached.sess_number_of_replicas => 0 => 0
    memcached.sess_randomize_replica_read => 0 => 0
    memcached.sess_remove_failed_servers => 0 => 0
    memcached.sess_server_failure_limit => 0 => 0
    memcached.sess_connect_timeout => 3000 => 3000
    memcached.sess_sasl_username => no value => no value
    memcached.sess_sasl_password => no value => no value
    memcached.sess_prefix => memc.sess. => memc.sess.
    memcached.sess_persistent => 0 => 0
    memcached.sess_lock_wait => not set => not set
    memcached.sess_lock_max_wait => not set => not set
    memcached.compression_type => fastlz => fastlz
    memcached.compression_factor => 1.3 => 1.3
    memcached.compression_threshold => 2000 => 2000
    memcached.serializer => php => php
    memcached.store_retry_count => 2 => 2
    memcached.default_consistent_hash => 0 => 0
    memcached.default_binary_protocol => 0 => 0
    memcached.default_connect_timeout => 0 => 0
     
  5. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    Looks like i did port memcached php 7 extension support to 123.08stable from the code at centminmod/memcached_install.inc at 123.08stable · centminmod/centminmod · GitHub

    FYI, inc/memcached_install.inc history of changes from 123.09beta01 to 123.08stable at History for inc/memcached_install.inc - centminmod/centminmod · GitHub
     
  6. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
  7. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    To troubleshoot, you need to check the the centmin.sh menu option 10 reinstall memcached log at /root/centminlogs can post a copy to Pastebin.com or Gists to share. Every centmin.sh menu option automatically saves a detailed log at /root/centminlogs :)
    i.e.
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep memcached
    -rw-r--r--   1 root root  229K Mar 12 07:07 centminmod_1.2.3-eva2000.09.001_120316-070622_memcached_reinstall.log
    -rw-r--r--   1 root root  119K Mar 12 07:17 centminmod_1.2.3-eva2000.09.001_120316-071611_memcached_reinstall.log
     
  8. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    I skimmed the memcached install logs, but not seeing anything out of the ordinary.

    There are multiple because I re-ran the install routine multiple times hoping it'd fix it.

    Here is the gist with the different log files: memcached install log · GitHub
     
  9. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    for 123.08stable memcache + php 7 never worked so what you see in log is normal = failed memcache compile on php 7. You need 123.09beta01 for memcache + php 7 to work.
     
  10. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    ?? I know that memcache doesn't compile, I already said so in the first post in this thread.

    What I'm trying to figure out is why I can no longer get a memcached (with the 'd') PHP extension that works with PHP 7, when I had no problems doing this same upgrade in January, on Centminmod master branch (which mirrors 123.08).

    These are the logs you requested. If there's something different that would be helpful, let me know.

    It's not a surprise to either of us that memcache doesn't compile, but what I don't understand is why the memcached PHP extension fails to load when I run `nprestart`. What changed between January and now on the git master branch or in one of the upstream repos that might be causing this?
     
  11. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    memcached php extension failed as libmemcached location couldn't find memcache.h
    Code (Text):
    checking for session includes... /usr/local/include/php
    checking for json includes... /usr/local/include/php
    checking for memcached session support... enabled
    checking for memcached igbinary support... disabled
    checking for memcached msgpack support... disabled
    checking for libmemcached location... configure: error: Unable to find memcached.h under /usr/local
    make: *** No targets specified and no makefile found.  Stop.
    make: *** No rule to make target `install'.  Stop.

    igbinary which failed to install due to problems with igbinary php7 git repo clone/pull
    Code (Text):
    Cloning into 'igbinary-php7'...
    fatal: Remote branch php7-dev not found in upstream origin
    Unexpected end of command stream
    
    compiling igbinary PHP extension for PHP 7.x ...
    inc/igbinary.inc: line 29: cd: igbinary-php7: No such file or directory
    make: *** No rule to make target `clean'.  Stop.
    autoconf (GNU Autoconf) 2.69
    Cannot find config.m4.
    Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
    
    Cannot find config.m4.
    Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

    I've backported igbinary and memcache php 7 extension support to 123.08stable for now Stable Branch - back port igbinary & memcache php extension PHP 7 support 123.08stable | Centmin Mod Community

    for memcached.h what's the output for the commands below ?
    Code (Text):
    yum -q whatprovides */memcached.h --enablerepo=remi --disableplugin=priorities

    Code (Text):
    yum -q whatprovides */memcached.h --disableplugin=priorities
     
    Last edited: Mar 12, 2016
  12. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    Sorry for the slow reply, we have a new baby. It's great, except a bit tougher to find time slots to work on servers without interruption.


    Here's what I get when running each command on one of the servers that does NOT have a working memcached + php7... Note that the `remi` repo is not found:

    Code:
    [root@kat ~]# yum -q whatprovides */memcached.h --enablerepo=remi --disableplugin=priorities
    
    
    Error getting repository data for remi, repository not found
    [root@kat ~]# yum -q whatprovides */memcached.h --disableplugin=priorities
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    
    
    
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : @base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    


    Here's what I get when running each command on the server that DOES have a working memcached + php7:

    Code:
    [root@ultravps ~]# yum -q whatprovides */memcached.h --enablerepo=remi --disableplugin=priorities
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    
    
    
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : @base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    
    
    
    [root@ultravps ~]# yum -q whatprovides */memcached.h --disableplugin=priorities
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    
    
    
    libmemcached-devel-1.0.16-5.el7.x86_64 : Header files and development libraries for libmemcached
    Repo        : @base
    Matched from:
    Filename    : /usr/include/libmemcached-1.0/memcached.h
    Filename    : /usr/include/libmemcached-1.0/struct/memcached.h
    Filename    : /usr/include/libmemcached/memcached.h
    


    Ideally all three of these servers have identical config, so either Remi should be removed from the working one, or added to the broken ones. What is the Centminmod official status on Remi repo... enable it or remove it?
     
    Last edited: Apr 3, 2016
  13. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:23 PM
    Paging @eva2000 :)
     
  14. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    Remi is installed by default but disabled by default unless you use --enablerepo=remi when needed or when centmin.sh code installs yum packages like libmemcached and imagemagick from remi repo

    probably easiest way is switch to 123.09beta01 branch as that is what's going to be stable soon

    just install remi repo.. in 123.09beta01 when you run centmin.sh menu option 15 to recompile imagick php extension, it auto detects if remi repo is installed and if missing, installs remi repo and sets it up
     
  15. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,584
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,774
    Local Time:
    5:23 AM
    Nginx 1.13.x
    MariaDB 5.5
    Or you can dig into centmin mod 123.09beta01 inc/imagick_install.inc code for the remi repo install commands to run manually centminmod/imagick_install.inc at 123.09beta01 · centminmod/centminmod · GitHub

    specific lines at centminmod/imagick_install.inc at 123.09beta01 · centminmod/centminmod · GitHub refer to functions in

    centos 6
    centminmod/downloads_centossix.inc at 123.09beta01 · centminmod/centminmod · GitHub

    centos 7
    centminmod/downloads_centosseven.inc at 123.09beta01 · centminmod/centminmod · GitHub

    associated yum priorities function for remi repo centminmod/yumpriorities.inc at 123.09beta01 · centminmod/centminmod · GitHub

    referenced .rpm install file urls are all in inc/downloadlinks.inc centminmod/downloadlinks.inc at 123.09beta01 · centminmod/centminmod · GitHub

    or easy way is switch to 123.09beta01 and when you run centmin.sh menu option 15 - it auto does all the remi repo install and yum priorities set for you :)
     
    Last edited: Apr 8, 2016