Cpanel EasyApache 4 How to install memcache php module

Installation of Memcache PHP extension using EasyApache4

We are using multiple PHP version on EasyApache4, so we need to install the Memcache on each PHP version individually. Run the following commands to install the Memcache module on different PHP versions.

PHP 5.4

 
/opt/cpanel/ea-php54/root/usr/bin/pecl install memcache

Verify using the following command:

 
/opt/cpanel/ea-php54/root/usr/bin/php -m | grep memcache

PHP 5.5

 
/opt/cpanel/ea-php55/root/usr/bin/pecl install memcache

Verify using the following command:

 
/opt/cpanel/ea-php55/root/usr/bin/php -m | grep memcache

PHP 5.6

 
/opt/cpanel/ea-php56/root/usr/bin/pecl install memcache

Verify using the following command:

 
/opt/cpanel/ea-php56/root/usr/bin/php -m | grep memcache

PHP 7.0

 
cd /usr/local/src/
wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip
unzip NON_BLOCKING_IO_php7.zip
mv pecl-memcache-NON_BLOCKING_IO_php7 pecl-memcache-NON_BLOCKING_IO_php70
cd pecl-memcache-NON_BLOCKING_IO_php70
/opt/cpanel/ea-php70/root/usr/bin/phpize 
./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config
make
cp modules/memcache.so /opt/cpanel/ea-php70/root/usr/lib64/php/modules/
echo 'extension=memcache.so' > /opt/cpanel/ea-php70/root/etc/php.d/memcached.ini

Verify:

 
/opt/cpanel/ea-php70/root/usr/bin/php -m | grep memcache

PHP 7.1

 
cd /usr/local/src/
wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip
unzip NON_BLOCKING_IO_php7.zip
mv pecl-memcache-NON_BLOCKING_IO_php7 pecl-memcache-NON_BLOCKING_IO_php71
cd pecl-memcache-NON_BLOCKING_IO_php71
/opt/cpanel/ea-php71/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config
make
cp modules/memcache.so /opt/cpanel/ea-php71/root/usr/lib64/php/modules/
echo 'extension=memcache.so' > /opt/cpanel/ea-php71/root/etc/php.d/memcached.ini

Verify:

 
/opt/cpanel/ea-php71/root/usr/bin/php -m | grep memcache

PHP 7.2

 
cd /usr/local/src/
wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip
unzip NON_BLOCKING_IO_php7.zip
mv pecl-memcache-NON_BLOCKING_IO_php7 pecl-memcache-NON_BLOCKING_IO_php72
cd pecl-memcache-NON_BLOCKING_IO_php72
/opt/cpanel/ea-php72/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php72/root/usr/bin/php-config
make
cp modules/memcache.so /opt/cpanel/ea-php72/root/usr/lib64/php/modules/
echo 'extension=memcache.so' > /opt/cpanel/ea-php72/root/etc/php.d/memcached.ini

Verify:

 
/opt/cpanel/ea-php72/root/usr/bin/php -m | grep memcache

Restart Apache:

 
service httpd restart

That’s it!