Installation and configuration notes of PHP accelerator APC under Linux

  • 2021-07-22 09:14:42
  • OfStack

At present, I use APC-3. 1.9 stable, and I can download the latest version from http://pecl.php.net/package/APC.

1. Installation


wget http://pecl.php.net/get/APC-3.1.9.tgz
tar xzvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php/bin/php-config --prefix=/usr/local/apc
make && make install

Note: Check the corresponding directory after installation and compilation:


ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
-rwxr-xr-x 1 root root 659164 Apr 8 18:30 apc.so

Installation successful!

2. Configuration/usr/local/php/etc/php. ini


vi /usr/local/php/etc/php.ini

shift+g to the last line, add at the end


[apc]
extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/apc.so"
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 64
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 0
apc.write_lock = On

Then copy apc. php from the APC directory to an accessible directory


cp /root/APC-3.1.9/apc.php /home/wwwroot/

3. Restart LNMPA


/root/lnmpa restart

4. Attachment: Method of installing apc under Windows

Download address: http://kromann.info/php5_2-Release_TS/php_apc. dll


extension = php_apc.dll


Related articles: