• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Issue How to install Memcache PECL extension for PHP (not Memcached)

  • Thread starter Deleted member 209767
  • Start date
D

Deleted member 209767

Guest
Server operating system version
CentOS 8.5.2111 x86_64
Plesk version and microupdate number
Plesk Obsidian 18.0.41.1
I already have Memcached installed and running
1669432975222.png

But now I need to install the Memcache (not Memcached) PECL extension for PHP in order to use this plugin:

I tried this:
Code:
yum install php74-php-pecl-memcache.x86_64

Then I follow the instructions but as soon as I upload object-cache.php it breaks the site with this error in the logs:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Class 'Memcache' not found in /var/www/vhosts/domain.net/public_html/wp-content/object-cache.php:987\nStack trace:\n#0 /var/www/vhosts/domain.net/public_html/wp-content/object-cache.php(100): WP_Object_Cache->__construct()\n#1 /var/www/vhosts/domain.net/public_html/wp-includes/load.php(730): wp_cache_init()\n#2 /var/www/vhosts/domain.net/public_html/wp-settings.php(131): wp_start_object_cache()\n#3 /var/www/vhosts/domain.net/public_html/wp-config.php(105): require_once('/var/www/vhosts...')\n#4 /var/www/vhosts/domain.net/public_html/wp-load.php(50): require_once('/var/www/vhosts...')\n#5 /var/www/vhosts/domain.net/public_html/wp-blog-header.php(13): require_once('/var/www/vhosts...')\n#6 /var/www/vhosts/domain.net/public_html/index.php(17): require('/var/www/vhosts...')\n#7 {main}\n thrown in /var/www/vhosts/domain.net/public_html/wp-content/object-cache.php on line 987'

According to what I found on google, Memcache not found error occurs when the extension is not installed/enabled

So... what is the correct way to install the Memcache PECL extension for PHP 7.4 with CentOS 8 and Plesk Obsidian 18?
 
The latest version of Memcache requires PHP version > 8.0:

# /opt/plesk/php/7.4/bin/pecl install memcache
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/memcache requires PHP (version >= 8.0.0), installed version is 7.4.33
No valid packages found
install failed


But you can compile the previous version with PHP 7.4 support:
Instruction is the following:

# yum install make gcc
# /opt/plesk/php/7.4/bin/pecl install memcache-4.0.5.2
# echo "extension=memcache.so" > /opt/plesk/php/7.4/etc/php.d/memcache.ini
# /usr/local/psa/bin/php_handler --reread


After that module should be loaded. Check it with:

# /opt/plesk/php/7.4/bin/php -m | grep memcache
memcache
 
The latest version of Memcache requires PHP version > 8.0:

# /opt/plesk/php/7.4/bin/pecl install memcache
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/memcache requires PHP (version >= 8.0.0), installed version is 7.4.33
No valid packages found
install failed


But you can compile the previous version with PHP 7.4 support:
Instruction is the following:

# yum install make gcc
# /opt/plesk/php/7.4/bin/pecl install memcache-4.0.5.2
# echo "extension=memcache.so" > /opt/plesk/php/7.4/etc/php.d/memcache.ini
# /usr/local/psa/bin/php_handler --reread


After that module should be loaded. Check it with:

# /opt/plesk/php/7.4/bin/php -m | grep memcache
memcache
after I run `/Applications/MAMP/bin/php/php7.4.3/bin/pecl install memcache-4.0.5.2` have error: `checking for the location of zlib... configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located`
 
@duyvipaz20 Have you seen that Plesk supports PECL installs directly through the GUI?
View attachment 24080
Unfortunately, I don't have GUI to manage PECL packages, I using MAMP PRO for macOS and it have PECL. I run command with like seem: `/Applications/MAMP/bin/php/php5.6.40/bin/pecl install memcache-3.0.8 --with-zlib-dir=/opt/homebrew/Cellar/zlib/1.3/include/zlib.h`

In that, `--with-zlib-dir=/opt/homebrew/Cellar/zlib/1.3/include/zlib.h` is my path root. I use brew to install zlib. after, i run command `brew info zlib` following:
1692766088646.png

And I still get the error above:
1692766168668.png
 
I see. Well, then I think it will be best to ask the question in an Apple-related forum. The experts here are using Plesk to manage their servers. Unless someone on here is a seasoned Mac user, too, you won't find a solution here.
 
Back
Top