Uncaught error class memcache not found in

Memcache is a PHP module acting as a cache server. It is notably used to improve the response time of websites. Memcached on the Wordpress side mainly uses the RAM of your hosting, and few CPUs. It saves objects such as API calls, page rendering and database call results in order to make these resources available more quickly.

memcache

Issue

Memcache, in our case, is a PHP module acting as a cache server. It is notably used to improve the response time of websites. Memcached on the WordPress side mainly uses the RAM of your hosting, and few CPUs. It saves objects such as API calls, page rendering and database call results in order to make these resources available more quickly.

You want to set up a caching system and you encounter an error similar to this one :

Fatal error: Uncaught Error: Class ‘Memcache’ not found in […]

Where does this error come from?

Most of the time this error is due to the lack of activation or support of the memcache extension (PHP) on your web server side.

It can also occur due to a problem with your WordPress installation.

Finally, it can occur for example following the restoration of a database or part of a previous database, on another hosting for example.

What can be done to solve this problem?

There is a way to “work around” the temporary problem, and a way to solve it.

If you choose to work around the problem, it will not give you the benefits of the memcache cache server. The goal here is to prevent the error from appearing while still keeping your website usable.

To simply “remove” this error:

If you have access to your database:

  • If you have access to a recent backup of your database and that it does not involve a significant loss of data or of your last works, you can try to restore this backup before setting up the memcached cache
    • To perform this operation, the easiest way is to connect to your database with your credentials and the right rights via a web interface provided by your host, or upload a recent version of phpMyAdmin on your site via (S)FTP : https://www.phpmyadmin.net/downloads/

If you don’t have access to your database (and you don’t want to install a client to access your database) :

  • Connect to your site using (S)FTP
  • Go to /wp-content
  • Rename or (save and) delete the file object-cache.php

To solve this problem:

Contact your hosting provider to see with him the possibilities of activating the memcache extension for PHP. This will solve your error and you will be able to set up your cache solution to speed up your website.

Be aware that there are different caching solutions, various extensions for WordPress. Nevertheless, make sure to check the compatibility of your hosting according to the solution you choose and to set up these solutions if you want them to be efficient. Don’t hesitate to contact an expert in the field who can guide you towards the best solution for your website and help you configure this solution.

Доброго времени суток, коллеги!
Крик о помощи заставил сделать ошибка:

Fatal error: Uncaught Error: Class ‘Memcache’ not found in C:OSPaneldomainsdirectoryindex.php:10 Stack trace: #0 {main} thrown in C:OSPaneldomainsdirectoryindex.php on line 10

Пока не поменял машину на новую и не столкнулся с необходимостью всё установить с нуля, всё работало на старой машине с более ранней версии OS, в которой я данную проблему решил легко и просто давно уже. Но…
Установил на новую машину под OS Win10 свежий open_server_5_3_5_ultimate
Модули установил следующие:

  • Apache_2.4-PHP_7.2-7.3-x64
  • PHP_7.3-x64_php
  • MySQL-8.0-x64
  • Memcached Version 1.5.10 [ естественно мы все помним, что OS только Memcache ]

В файл конфига PHP уже по пару лет назад отработанной схеме включил запись:

;extension = pgsql
extension  = php_memcache.dll ;Ну т.е. добавил эту строку
;extension = phpdbg_webhelper


В папку OSPanelmodulesphpPHP_7.3-x64ext конечно закинул файл, скачанный с
https://github.com/4EPHblN/PHP7-memcache-dll

Пробовал разные варианты и не только по выше указанному источнику, но и с ранее мной используемого:
https://github.com/nono303/PHP7-memcache-dll

По второй ссылке более свежие, чем по первой.
Сразу оговорюсь, что перепробовал вариантов тысячу, менял версии PHP на более низкие, под них менял в папке dll, да и чего я только несколько часов не делал — результат один и тот же. Я даже сам себя перепроверил в когда-то написанном посте:
viewtopic.php?p=23783#p23783

Далее запуск OS, стандартный код проверки:
https://www.php.net/manual/en/memcache.set.php

$memcache_obj = new Memcache;

$memcache_obj->connect('localhost', 11211);

$memcache_obj->set('var_key', 'some really big variable', MEMCACHE_COMPRESSED, 50);

echo $memcache_obj->get('var_key');

На что естественно ничего, кроме ошибки не дало, при этом PHPMemcachedAdmin работает ( ессно ) и в PHP info он прописан в PATH, но отдельно как redis или mysqli его нет ни с буквой «d», ни без.

Пробовал и Memcached

$m = new Memcached();
echo get_class($m);

Но это привело, ожидаемо конечно же, к ошибке Fatal error: Uncaught Error: Class ‘Memcached’ not found

Конечно же попробовал Redis-3.2-x64, ну вдруг не какой-то баг сборки или чего-то там, а во мне:

$redis = new Redis();
$redis->pconnect('localhost');
$redis->set('test', 'test');
echo $redis->get('test');
$redis->set('test', '<br> testing test');
echo $redis->get('test');
//$redis->del('test');
//echo $redis->get('test');

Конечно же Redis полетел без всяких проблем.

В общем крик помощи к Вам всем, уважаемые коллеги! Хелп!

Hello,

I have been trying to follow the Wiki page regarding ownCloud in order to set up ownCloud on my computer. However, when I try to access ownCloud’s homepage (https://localhost/owncloud/), I only see a blank page.

I am a noob when it comes to server applications, so I might be making a silly mistake smile.

Nginx’s log shows the following output:

PHP message: PHP Fatal error:  Uncaught Error: Class ‘Memcached’ not found in /etc/webapps/owncloud/config/config.php:958

(full output here, and nginx.conf here)

‘nginx -t’ shows that my configuration is correct.

What I have done so far:
Install the following packages:

  • nginx-mainline 1.11.3-1

  • php 7.0.10-1

  • php-fpm 7.0.10-1

  • php-apcu 5.1.5-1

  • php-apcu-bc 1.0.3-1

  • php-intl 7.0.10-1

  • php-mcrypt 7.0.10-1

  • owncloud 9.1.0-1

  • mariadb 10.1.16-2

I configured those packages as described in the Wiki. In particular, I enabled apcu, apc backwards compability and apcu cli in /etc/php/config.d/apcu.ini:

extension=apcu.so
apc.enable_cli=1
; install php-apcu-bc and enable apc.so for APC compatibility
extension=apc.so

I enabled APCu as the cache mechanism for ownCloud (/usr/share/webapps/owncloud/config/config.php)

‘memcache.local’ => ‘OCMemcacheAPCu’,

(full config here)

«php -i» shows that the APCu module is loaded, as well as APC backwards compability and cli:

apc
APC Compatibility => 1.0.3
APCu Version => 5.1.3
apcu
APCu Support => Enabled
APCu Debugging => Disabled
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp

(full log here)

My research has shown that there are some issues when using APCu with PHP7 (such as this one). However, most of the solutions pointed at enabling APCu cli (which I have done) or installing php-apcu-bc. What confuses me is that Memcached sounds like a class that would be used by «memcached» not APCu, so it is possible that ownCloud is trying to use memcached instead of APCu.

I also tried not using any cache mechanism for ownCloud, but it seems that this is not possible.

I am not sure about what to try next. Any ideas?

Thanks in advance.

Edit: I gave up and switched to Apache and ownCloud works now. The original issue was not solved though.

Last edited by rtrsthkng (2016-09-03 10:18:36)

Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!

Главная
Документация
Новости
Форум

За последние 24 часа нас посетили 11595 программистов и 1179 роботов. Сейчас ищут 212 программистов …

Проблема с memcached

Тема в разделе «PHP для новичков», создана пользователем IvanKut, 26 июн 2020.


  1. IvanKut

    IvanKut
    Активный пользователь

    С нами с:
    27 июл 2018
    Сообщения:
    256
    Симпатии:
    0

    Привет
    В phpinfo все выводится, что memcached есть.
    Но выпадает fatal
    Fatal error: Uncaught Error: Class ‘Memcache’ not found in test.php:5 Stack trace: #0 {main} thrown in

    Что может быть не так?

    [​IMG]

    #1


    IvanKut,

    26 июн 2020


  2. S_t_e_e_p

    S_t_e_e_p
    Активный пользователь

    С нами с:
    12 июл 2012
    Сообщения:
    181
    Симпатии:
    4

    А Memcache установили?

    #2


    S_t_e_e_p,

    26 июн 2020


  3. IvanKut

    IvanKut
    Активный пользователь

    С нами с:
    27 июл 2018
    Сообщения:
    256
    Симпатии:
    0

    @S_t_e_e_p блин сейчас понял что memcache и memcaheD это разные вещи.
    Единственно не понял, в чем разница у этих двух расширений?

    #3


    IvanKut,

    26 июн 2020


  4. S_t_e_e_p

    S_t_e_e_p
    Активный пользователь

    С нами с:
    12 июл 2012
    Сообщения:
    181
    Симпатии:
    4

    @IvanKut, почитай, в гугле много инфы

    #4


    S_t_e_e_p,

    26 июн 2020

(Вы должны войти или зарегистрироваться, чтобы разместить сообщение.)

Показать игнорируемое содержимое

Ваше имя или e-mail:
У Вас уже есть учётная запись?
  • Нет, зарегистрироваться сейчас.
  • Да, мой пароль:
  • Забыли пароль?

Запомнить меня

Понравилась статья? Поделить с друзьями:
  • Uncaught error extension context invalidated
  • Uncaught error expected the reducer to be a function
  • Uncaught error dropzone already attached
  • Uncaught error class evtimer not found
  • Uncaught error call to undefined function imagecreatefrompng