If you’re here, then you curious about Alternative PHP Cache (APC). Definitely you know what is that.
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. — PHP.net
— PHP.net
It was conceived, as free, open and stable framework for caching and optimisation of the initial code PHP, as well possibly caching user data.
Let’s install it in Ubuntu:sudo apt-get install php-apc
In CentOS:yum install php-pear php-devel httpd-devel pcre-devel gcc make
Second step:pecl install apc
Restart Apache in Ubuntu:sudo /etc/init.d/apache2 restart
In CentOS:service httpd restart
Below I shared optimal, in my opinion, APC configuration:
extension="apc.so"
apc.enabled=1
apc.stat=0
apc.shm_segments=1
apc.shm_size=512M
apc.ttl=7200
apc.user_ttl=7200
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.max_file_size=1M
apc.num_files_hint=0
apc.lazy_classes=1
apc.lazy_functions=1
You can copy and paste to your file apc.ini on the server. In UNIX-like operating system, like Ubuntu Server, the file is here:/etc/php5/conf.d/apc.ini
But in CentOS is here:/etc/php.d/apc.ini
/