Skip to main content

Installing Memcache on EasyApache 4 for PHP 7

Memcache
Posted by admin on 7th Oct 2016

We are going to grab a ported version here: https://github.com/websupport-sk/pecl-memcache

So the following steps are:

 1. wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip
 2. unzip NON_BLOCKING_IO_php7.zip
 3. cd pecl-memcache-NON_BLOCKING_IO_php7
 4. /opt/cpanel/ea-php70/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config && make
 5. cp modules/memcache.so /opt/cpanel/ea-php70/root/usr/lib64/php/modules/
 6. echo 'extension=memcache.so' >/opt/cpanel/ea-php70/root/etc/php.d/memcached.ini
 7. service httpd restart

Some notes for the above:

  • Replace each full path that I've used with the appropriate full path on your own system. While I have /opt/cpanel/ea-php70/root/, you may have /opt/php-7.0.7/. If you have multiple PHP versions installed, as I do, running phpize may end up building using an old version of PHP. I discovered this after much trial and error.
  • To find out where your PHP modules folder is, you can run "/opt/cpanel/ea-php70/root/usr/bin/php -i | grep extension_dir"
  • You may not need to perform step 6 where I am creating a memcached.ini if you already have it loaded elsewhere.
  • You can verify if it was correctly built and installed using "/opt/cpanel/ea-php70/root/usr/bin/php -i | grep memcache". If you see various memcache entries, everything was installed successfully.

 

Taken from: Memcache extension with PHP 7 on CentOS fails to install

If you are looking for installing memcache on EA4 for PHP 5.6, follow this link

 

Back to top