SvennD
PHP 5.4, APC/Zend Optimizer+ on Centos 7
December 31, 2015

PHP 5.4, APC/Zend Optimizer+ on Centos 7

Posted on December 31, 2015  •  2 minutes  • 260 words  •  Suggest Changes

The interwebs is a bit unclear on this topic, but on a “clean” Centos 7.1 (tested on digitalocean) the PHP version is v5.4 , which is a bit of a bugger, since from v5.5 Zend Optimizer+ is included in the core of PHP, making PHP allot faster, about 70% faster for sure, if we can believe the benchmarks (gone). I need APC not for the user cache but for the in memory storage of compiled PHP bytecode. So both Zend Optimizer+ or APC would do fine. Since Zend Optimizer is included in the PHP core of newer versions, Centos will someday push this (in the not so near future I guess). So I would recommend to use Zend Optimizer+, but feel free to ignore that advice, I am no expert. I will test both and decide then. Thought I doubt I will find much difference.

APC

If you need the user cache : yum install php-pecl-apcu

# Install APC
pecl install apc

#nano /etc/php.d/apc.ini
extension=apc.so
apc.enabled=1

restart httpd / php-fpm

You can validate that its running + stats by activating the apc.php file. Which can be found here (source).

Zend Optimizer+

yum install php-pecl-zendopcache

restart httpd / php-fpm

The config file is located : /etc/php.d/opcache.ini

There is no “official” statics script for Zend Opcache I could find, but a user (Rasmus Lerdorf) has made something similar.

wget https://raw.githubusercontent.com/rlerdorf/opcache-status/master/opcache.php it in some public directory to see the nice stats.

FUBAR PHP v5.4

You can also ditch PHP v5.4 from Centos repo’s and add another repo, such as webtastic repo or remirepo.

Support

If you enjoyed this website, consider buying me a Dr. Pepper

Buy me a Dr PepperBuy me a Dr Pepper