Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Fix "Memcache Extension is Not Loaded" in Bitrix

5 min read
11.05.2026

1. Check if Memcache is Installed

First, verify whether the Memcache extension is already present on your system.

Bitrix Memcache Extension Error
Bitrix Memcache — install + enable + tell Bitrix to use it.

For other Bitrix tuning topics, see mbstring.func_overload Bitrix Guide, max_input_vars in Bitrix, Bitrix MySQL Freezes — Causes and Solutions, and Bitrix Error Log — Locate, Enable, Analyze.

php -m | grep memcache

Expected Results:

  • If you see memcache or memcached in the output, the extension is installed but may not be enabled for your web server's PHP configuration.
  • If there's no output, the extension is not installed and needs to be installed.

Also check if the Memcached service is running:

systemctl status memcached

And verify your PHP version to install the correct package:

php -v
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

2. Install the Memcache Extension

Memcache requires two components: the Memcached service/daemon and the PHP extension.

Step 1: Install Memcached Service

For Ubuntu/Debian Systems

sudo apt update
sudo apt install memcached libmemcached-tools -y

For CentOS/RHEL/Fedora Systems

sudo yum install memcached -y

After installation, start and enable the service:

sudo systemctl start memcached
sudo systemctl enable memcached

Step 2: Install PHP Memcache Extension

Important: Install the package that matches your PHP version exactly.

For Ubuntu/Debian (PHP 7.4)

sudo apt install php7.4-memcache php7.4-memcached -y

For Ubuntu/Debian (PHP 8.0)

sudo apt install php8.0-memcache php8.0-memcached -y

For Ubuntu/Debian (PHP 8.1)

sudo apt install php8.1-memcache php8.1-memcached -y

For CentOS/RHEL (via Remi Repository)

# Enable Remi repository first if needed
sudo yum install php-pecl-memcache php-pecl-memcached -y

Verify Installation

# Check both extensions
php -m | grep -E "memcache|memcached"

# You should see both memcache and memcached listed

3. Enable Memcache in PHP Configuration

If the extension is installed but not being loaded by your web server's PHP, you need to enable it in the appropriate php.ini file.

Find the Correct php.ini File

# For command-line PHP (initial check)
php --ini | grep "Loaded Configuration File"

# For web server PHP (may be different)
sudo find /etc -name "php.ini" | grep -E "(apache2|fpm|httpd)"

Edit php.ini

# For Apache on Ubuntu/Debian
sudo nano /etc/php/7.4/apache2/php.ini

# For PHP-FPM (Nginx) on Ubuntu/Debian
sudo nano /etc/php/7.4/fpm/php.ini

# For CentOS/RHEL
sudo nano /etc/php.ini

Add or Uncomment Extensions

Search for or add these lines in the extensions section:

extension=memcache.so
extension=memcached.so

Save the file (Ctrl+O, Enter, Ctrl+X).

Restart Web Services

# For Apache
sudo systemctl restart apache2

# For Nginx with PHP-FPM
sudo systemctl restart php7.4-fpm
sudo systemctl restart nginx

# For CentOS Apache
sudo systemctl restart httpd

# Always restart Memcached service too
sudo systemctl restart memcached

Verify Extension is Loaded

php -m | grep -E "memcache|memcached"

4. Configure Memcache for Bitrix

After installing and enabling the extension, configure Bitrix to use Memcache for caching.

Edit Bitrix Configuration File

Modify dbconn.php

sudo nano /home/user/public_html/bitrix/php_interface/dbconn.php

Replace /home/user/public_html/ with your actual Bitrix installation path.

Add Memcache Configuration

Find the section where cache settings are defined (usually near the end) and add or modify:

// Memcache configuration for Bitrix
define("BX_CACHE_TYPE", "memcache");
define("BX_MEMCACHE_HOST", "127.0.0.1");
define("BX_MEMCACHE_PORT", "11211");
define("BX_CACHE_SID", $_SERVER["DOCUMENT_ROOT"]."|site");

// Optional: Use Memcached instead (recommended)
// define("BX_CACHE_TYPE", "memcached");

// For multiple Memcache servers (clustered setup)
// define("BX_MEMCACHE_HOST", "mem1.site.com;mem2.site.com");
Configuration Notes:
  • BX_CACHE_TYPE: Use "memcache" for the older extension or "memcached" for the newer one
  • BX_MEMCACHE_HOST: 127.0.0.1 for local server, or external IP/hostname for remote
  • BX_MEMCACHE_PORT: Default is 11211

Alternative: Configure via Bitrix Admin Panel

  1. Log into your Bitrix Admin Panel
  2. Go to Settings > System Settings > Cache Settings
  3. Select Memcache or Memcached as cache type
  4. Enter server details: 127.0.0.1:11211
  5. Save and clear cache

5. Test Memcache Installation

Method 1: PHP Info Test

# Create a test file (in a secure location, not web root for production)
echo "<?php phpinfo(); ?>" | sudo tee /home/user/public_html/test_memcache.php

Visit http://yourdomain.com/test_memcache.php and search for "memcache" or "memcached". You should see configuration sections for both extensions.

Security: Remove test files after verification:
sudo rm /home/user/public_html/test_memcache.php

Method 2: Command Line Test

# Test Memcached service connectivity
echo "stats" | nc 127.0.0.1 11211

# Test PHP Memcache functionality
php -r "\$mem = new Memcache; \$mem->connect('127.0.0.1', 11211); echo \$mem->getVersion();"

Method 3: Bitrix Cache Test

  1. In Bitrix Admin Panel, go to Settings > System Settings > Performance
  2. Check if Memcache is detected in the cache section
  3. Run the cache test tool if available

6. Summary of Fixes

Issue Solution
Memcache not installed sudo apt install php7.4-memcache php7.4-memcached
Memcache extension not loaded Add extension=memcache.so and extension=memcached.so in php.ini
Bitrix not using Memcache Configure dbconn.php with BX_CACHE_TYPE, BX_MEMCACHE_HOST, BX_MEMCACHE_PORT
Memcache service not running sudo systemctl restart memcached
PHP version mismatch Install correct version package: php7.4-memcache for PHP 7.4, etc.
Web server not recognizing changes Restart Apache/Nginx and PHP-FPM services
Connection refused errors Check firewall: sudo ufw allow 11211/tcp or firewall-cmd --add-port=11211/tcp

With Memcache properly installed and configured, Bitrix will use memory-based caching to significantly improve page load times and reduce database load!

Frequently asked questions
Bitrix accepts either. The older `memcache` extension is fine for most use cases; the newer `memcached` (with 'd') has more features and is more actively maintained. New installs: pick memcached. Existing installs with memcache working: leave it. They're separate PHP extensions with similar APIs but separate codebases.
Wrong SAPI. CLI php has the extension but PHP-FPM (which runs Bitrix in production) doesn't. Verify with `php-fpm -m | grep memcache` separately from `php -m`. If FPM doesn't list it, the extension config didn't get loaded for FPM. Check `/etc/php//fpm/conf.d/` for the extension's ini file; copy from `/etc/php//cli/conf.d/` if missing.
Tell Bitrix to use it as cache backend. Settings → Performance → Performance Panel → Cache → set type to memcached (or memcache), specify host (usually 127.0.0.1) and port (11211). Bitrix may need a cache rebuild after changing — Settings → Clear Cache. Without this step, the extension is loaded but unused.
Yes. The PHP extension is the client; you still need memcached server to talk to. `systemctl status memcached`. If not installed, `apt install memcached` (Debian/Ubuntu) or `yum install memcached` (RHEL/CentOS). Default config listens on 127.0.0.1:11211 which is what Bitrix expects. Restart on changes.
Related articles
Install ImageMagick or GD — Server Administrator's Guide
Fix "ZIP Extension Needs to Be Loaded" in OpenCart
Fix "Your PHP Version Does Not Meet the Bitrix Requirements" Error