CentOS 5
Sponsored Link

Use PHP APC
2015/01/17
 
Enable APC ( Alternative PHP Cache ) and makes PHP be fast.
[1] Install APC.
[root@www ~]#
yum --enablerepo=epel -y install php-pecl-apc  
# install from EPEL
[root@www ~]#
vi /etc/php.d/apc.ini
# line 7: specify shared memory(MB)

# need to consider with specs of the server

apc.shm_size=
512
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

[2] Create "phpinfo" like follows and make sure APC enabled.
[root@www ~]#
echo -e "<?php\nphpinfo();\n?>" > /var/www/html/phpinfo.php

[3] Enable admin script of APC.
[root@www ~]#
mkdir /var/www/html/apc

[root@www ~]#
cp /usr/share/doc/php-pecl-apc-*/apc.php /var/www/html/apc

[root@www ~]#
vi /var/www/html/apc/apc.conf.php
# create new

<?php
   defaults('ADMIN_USERNAME','apcadmin');  
# set any username

   defaults('ADMIN_PASSWORD','apcadmin');  
# set any password

?>
[root@www ~]#
vi /etc/httpd/conf.d/apc.conf
# create new

<Directory /var/www/html/apc>
   Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1 10.0.0.0/24
# IP address you allow

</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

  Access to "http://(hostname or IP address)/apc/apc.php" with Web browser. Then following screen is shown and it's possible to make sure status of APC.
Matched Content
 
Tweet