1

I setup a new CentOS 7 server in Vagrant to run PHP, nginx, MySQL (MariaDB) and memcached (note the d on the end). I can get memcached to run fine, but I can't get the Amazon Elasticache .so file to be loaded by PHP. I know the file exists. How do I get PHP to load this extension, or troubleshoot why it won't?

I have followed the instructions for installing this extension here: Installing the ElastiCache Cluster Client for PHP

How do I troubleshoot PHP and why it may not load an extension?

PersianGulf
  • 602
  • 8
  • 21
Ryan
  • 63
  • 7
  • If you follow that guide it should definitely work for you. Did you restart PHP after your changes? – Bazze May 12 '15 at 06:53
  • I have followed it and restarted many times. I swap in the memcached.so extension manually, and that works, shows up in php info, but I remove that and put in the amazon-elasticache-cluster-client.so and it won't load it. No errors, just ignores its existence. – Ryan May 12 '15 at 15:09
  • Did you download the correct .so file for your PHP version and OS (64/32-bit)? – Bazze May 17 '15 at 10:36
  • Yes I did download the 64 bit edition for PHP 5.3 which is what I'm running on CentOS 7. I checked the uname -a to be sure that is what I have. – Ryan May 18 '15 at 15:10
  • 1
    Okay, and did you do as they mentioned in note under the "[Other Linux distributions](http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Appendix.PHPAutoDiscoverySetup.html#d0e16600)"? It says: _"On some systems, notably CentOS7 and Red Hat Enterprise Linux (RHEL) 7.1, libsas12.so.3 has replaced libsas12.so.2. On those systems, when you load the ElastiCache cluster client, it attempts and fails to find and load libsas12.so.2. To resolve this issue, create a symbolic link to libsas12.so.3 so that when the client attempts to load libsas12.so.2, it is redirected to libsas12.so.3."_ – Bazze May 19 '15 at 19:03
  • I did in fact symlink the 2 as noted in the docs, which did not seem to help either. Excellent idea though. – Ryan May 22 '15 at 19:39

2 Answers2

3

In addition to @Bazze's excellent comment regarding libsas, you may be missing a dependency ( or a dependency on the right architecture)

Note that it is fairly common to have to install both 32-bit and 64-bit libraries for some applications.

If you use ldd /path/to/amazon-elasticache-cluster-client.so, do you see any lines mentioning ‘unresolved’ or similar? (Post the whole output in your question.

A common problem such as this may just be resolved by running ldconfig, which should be run after installing (or adding symlinks to) libraries.

Another problem might be related to permissions or access-control systems such as SELinux. What does sestatus show? Perhaps you need to run restorecon over the directory containing the libraries.

Cameron Kerr
  • 4,069
  • 19
  • 25
  • Though @Bazze's comment was related, this answer is the one that led me to the issue being resolved. I used the ldd command to find out that the symlink of libsas2.so.2 wasn't working correctly. Deleting and readding that symlink and restarting php-fpm solved this issue. Thanks Bazze and Cameron Kerr for your help. Made me look good at my new job and I appreciate it. – Ryan May 22 '15 at 22:02
2

Sometimes just typing at the command line:

$ php -m

To view the loaded modules will show some information about why some modules aren't being loaded. Also ini file syntax errors causing modules not to load are sometimes revealed by the command line:

$ php --ini

These are the first things I'd do to debug a module that's not loading.

tobuslieven
  • 121
  • 3
  • Good feedback, but I have tried both of these. I get a message about the dynamic extension not being able to be loaded on php -m from /usr/lib64/php/modules/ and I've tried all the things I've seen to get that working too, however it won't find it still. I have added the path the extension=/path/to/amazon-elasticache-cluster-client.so and done what the link suggests as far as putting it in the memcached.ini file, but it will not load it. – Ryan May 18 '15 at 15:12