Dedicated Guest Post Blog

Install APCU with EasyApache4 or EA4 in WHM + CentOS

261

EA4 did not support APCu in the prior versions but after upgrading your WHM to latest version you can install APCu without hassle, the problem with EasyApache4 is that you can have multiple PHP Versions installed on a single server which is great but when installing APCu you will have to install and enable APCu for every PHP versions separately.

What is APCu Cache?
APCu Cache is the userdata component of the old APC, without the bytecode caching, because OpCache is now the standard bytecode caching for PHP, but doesn’t provide userdata caching

First know to which PHP version you are going to install APCU, valid PHP versions are ea-php54 (PHP 5.4),ea-php55 (PHP 5.5), ea-php56 (PHP 5.6), ea-php70 (PHP 7.0) & ea-php71 (PHP 7.1). There may be any latest PHP versions may available in the future you can check them in EasyApache4 Configuration menu that looks similar to image below.

The following steps guide how to install APCU for PHP 7, if you want to install APCU for any other PHP versions replace ea-php70 in the command with suitable PHP version (example: for PHP5.6 replace ea-php70 with ea-php56)

/opt/cpanel/ea-php70/root/usr/bin/pecl install apcu

 

Installation will ask if you want to enable debugging just press Enter which is default for NO (Disable debugging).
APCU is now installed but it is not working yet because you have to add
extension=apcu.so to php.ini & restart apache
you can do that simply by using following commands, use them one by one.

echo ";APCU Enabled" >> /opt/cpanel/ea-php70/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php70/root/etc/php.ini
service httpd restart

 

Im using the following APCU configuration, on a server i manage, you can change parameters as for your need, if you have a better configuration, explain me in comments i can update this article.

;APCU Enabled
extension=apcu.so
apc.enabled=1
apc.shm_size = 64M
apc.ttl=7200
apc.enable_cli=1
apc.gc_ttl=3600
apc.entries_hint=40960
apc.slam_defense=1
apc.serializer=igbinary

Download APCu Monitor (Attached below) and upload it to your Domain document root, you can check statistics by visiting http://www.yourwebsite.com/apcu.php (This php doesn’t require authentication, delete it or set admin password by editing the apcu.php).

For the Lazy Devs who don’t have time to read everything above 🙂

Install APCU for PHP 5.4 with EasyApache4 (EA4) on CentOS

printf "\n" | /opt/cpanel/ea-php54/root/usr/bin/pecl install apcu
echo ";APCU Enabled" >> /opt/cpanel/ea-php54/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php54/root/etc/php.ini
service httpd restart

 

Install APCU for PHP 5.5 with EasyApache4 (EA4) on CentOS

printf "\n" | /opt/cpanel/ea-php55/root/usr/bin/pecl install apcu
echo ";APCU Enabled" >> /opt/cpanel/ea-php55/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php55/root/etc/php.ini
service httpd restart

 

Install APCU for PHP 5.6 with EasyApache4 (EA4) on CentOS

printf "\n" | /opt/cpanel/ea-php56/root/usr/bin/pecl install apcu
echo ";APCU Enabled" >> /opt/cpanel/ea-php56/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php56/root/etc/php.ini
service httpd restart

 

Install APCU for PHP 7 with EasyApache4 (EA4) on CentOS

printf "\n" | /opt/cpanel/ea-php70/root/usr/bin/pecl install apcu
echo ";APCU Enabled" >> /opt/cpanel/ea-php70/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php70/root/etc/php.ini
service httpd restart

 

Install APCU for PHP 7.1 with EasyApache4 (EA4) on CentOS

printf "\n" | /opt/cpanel/ea-php71/root/usr/bin/pecl install apcu
echo ";APCU Enabled" >> /opt/cpanel/ea-php71/root/etc/php.ini
echo "extension=apcu.so" >> /opt/cpanel/ea-php71/root/etc/php.ini
service httpd restart

Download APCU Monitor

error: Oops! Every unique content of this domain are protected with DMCA, Copying this blog will result in a DMCA Complain.
You can submit your Guest Posts too! Learn more
+