0

Running CentOS7, I installed Memcached via:

yum install memcached libmemcached

php -i | grep memcached shows:

/etc/php.d/50-memcached.ini
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.default_binary_protocol => Off => Off
memcached.default_connect_timeout => 0 => 0
memcached.default_consistent_hash => Off => Off
memcached.serializer => igbinary => igbinary
memcached.sess_binary_protocol => On => On
memcached.sess_connect_timeout => 0 => 0
memcached.sess_consistent_hash => On => On
memcached.sess_consistent_hash_type => ketama => ketama
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => not set => not set
memcached.sess_lock_retries => 5 => 5
memcached.sess_lock_wait => not set => not set
memcached.sess_lock_wait_max => 150 => 150
memcached.sess_lock_wait_min => 150 => 150
memcached.sess_locking => On => On
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_persistent => Off => Off
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => Off => Off
memcached.sess_remove_failed_servers => Off => Off
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.sess_server_failure_limit => 0 => 0
memcached.store_retry_count => 2 => 2
Registered save handlers => files user memcache memcached

However, when I run a PHP file in browser, I get the following error: "Uncaught Error: Class 'Memcached' not found in (my path)..."

When I run phpinfo() in the browser, Memcached isn't loaded at all.

I have SELinux running: getsebool httpd_can_network_memcache httpd_can_network_memcache --> on

I do know that Memcached and Memcache are two different libraries, so I'm not sure if that's helping my problem at all.

My web server is nginx, and I have already tried restarting it a couple of times.

user3183717
  • 4,427
  • 6
  • 20
  • 42
  • 3
    php-cli (command line) and php-fpm (nginx) use two different configuration files. The `phpinfo()` output in your browser will tell you which nginx is using. You likely have memcache enabled in the former but not the latter. – Alex Howansky Apr 28 '20 at 16:37
  • Does this answer your question? [How to know which php.ini is used?](https://stackoverflow.com/questions/14558150/how-to-know-which-php-ini-is-used) – Nico Haase Apr 28 '20 at 16:42
  • Hmm okay, Server API: FPM/FastCGI. phpinfo() does show that the config file is in /etc/php.ini. When I go to that file and add: extension=memcached.so, "php -i" returns this error: PHP Warning: PHP Startup: Unable to load dynamic library 'memcached.so' (tried: /usr/lib64/php/modules/memcached.so (/usr/lib64/php/modules/memcached.so: undefined symbol: php_json_decode_ex), /usr/lib64/php/modules/memcached.so.so (/usr/lib64/php/modules/memcached.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 – user3183717 Apr 28 '20 at 16:45
  • I ran `service php-fpm restart` and now Memcached loads in phpinfo(). Thanks! – user3183717 Apr 28 '20 at 17:04

0 Answers0