24 03 2013
APC.sh
APC is a PHP accelerator – https://en.wikipedia.org/wiki/Alternative_PHP_Cache#Alternative_PHP_Cache_.28APC.29
This script installs APC and sets the cache size to 128M, 256M, or 512M depending on the total RAM size of the server.
#!/bin/bash
#
# Install APC on CentOS/cPanel
# # To use do; wget http://imadinosaur.net/scripts/apc && sh apc
RAM=`free -m | grep Mem | awk '{print $2}'`
printf "\n" | pecl install apc
if [ $RAM -le 1024 ]; then
echo -e "extension = apc.so \napc.enabled = 1 \napc.shm_size = 128M" >> /usr/local/lib/php.ini;
elif [ $RAM -le 4096 ]; then
echo -e "extension = apc.so \napc.enabled = 1 \napc.shm_size = 256M" >> /usr/local/lib/php.ini;
else
echo -e "extension = apc.so \napc.enabled = 1 \napc.shm_size = 512M" >> /usr/local/lib/php.ini;
fi
service httpd restart