Support » Plugin: Memcached Object Cache » PHP8
PHP8
-
Your plugin works great with PHP7.4, but when I upgrade to PHP8, memcached doesn’t work. Does not show enabled in my WP admin, but when I switch back to PHP7.4, memcached shows enabled and works great.
-
Hey there,
we’ve been running it on both 8.0 and 8.1 for a while now. That said, we use this extension https://pecl.php.net/package/memcache (as opposed to memcached, mind the last d). Could you give us some more info on your environment? Does php8 have the correct extensions?
Hi, thank you for your help. Yes, i’m using both extensions, and both configured for php8. Here are my files:
object-cache
if ( ! defined( ‘WP_CACHE_KEY_SALT’ ) ) {
define(‘WP_CACHE_KEY_SALT’, ‘tx4bISxTxZxxFxwPn6CxxqepUjuSxBxlxA1kxxxxxwxG6xGxxxLxCyxIHx3keSJG’);
}wp-config
define(‘WP_CACHE_KEY_SALT’, ‘tx4bISxTxZxxFxwPn6CxxqepUjuSxBxlxA1kxxxxxwxG6xGxxxLxCyxIHx3keSJG’);
Don’t think it’s a configuration issue. If it works fine on 7.4, I’m guessing you’re using an outdated version of the plugin (no php8+ support).
Could you run this on your server and paste the output:
php -v && php -m | grep memcache
Here is the output from the command that you provided me
[root@node1467 ~]# php -v && php -m | grep memcache
bash: syntax error near unexpected token `;&’
[root@node1467 ~]#Heh, that didn’t work. Let’s just run them as separate commands:
php -v
And
php -m | grep memcache
Here is the output (I did go back to PHP 7.3 while were troubleshooting):
[root@node1467 ~]# php -v
PHP 7.3.33 (cli) (built: May 18 2022 00:28:21) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.33, Copyright (c) 1999-2018, by Zend Technologies
[root@node1467 ~]#[root@node1467 ~]# php -m | grep memcache
memcache
memcached
[root@node1467 ~]#Could you please do the same while on php 8.0? Trying to figure what is missing. Still think it might be old extension versions.
Btw. How did you install the extensions? Pecl?
Okay, this is on our test site. When using your code and running PHP8, our test site throws an error (below that are the results of the commands you asked for):
There has been a critical error on this website.
[its420somewhere@node1467 test.its420somewhere.com]$ php -v PHP 8.0.19 (cli) (built: May 18 2022 03:36:01) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.19, Copyright (c) Zend Technologies with Zend OPcache v8.0.19, Copyright (c), by Zend Technologies [its420somewhere@node1467 test.its420somewhere.com]$ php -m | grep memcache memcached
Ah, ok. You need to have
memcache
installed, notmemcached
. Check the output for PHP 7.3.Just to be clear, don’t both of them need to be installed per your install instructions?
Just to be clear, don’t both of them need to be installed per your install instructions?
It can be confusing. The
memcached
we mention is the cache store server: https://memcached.org/. It is unrelated to PHP.For PHP, there are two extensions.
memcache
andmemcached
. They are both extensions that allow PHP to communicate with the above mentioned cache store server. This plugin is developed specifically for thememcache
extension.Hope that helps.
Okay, my host installed it, even though they told it was installed before. They did add this note, any thoughts? I’m not an expert, just trying to understand.
[root@node1467 ~]# php -m | grep memcache memcache memcached Still, I'd like to add that memcache is a bit outdated, so if memcached works well with your project(s), I'd recommend using it instead.
They just looked at the release dates.
memcache
is fine, and works well (running it on a lot of sites).But the most important question is, does it work now with PHP 8.0?
Yes, it’s working fine on my live and test site now with PHP8.
Thanks for all your help.
Steve
Nice, glad to hear it!
- The topic ‘PHP8’ is closed to new replies.