PHP Doku:: Alternativer PHP Cache - book.apc.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDas Verhalten von PHP beeinflussenAlternativer PHP Cache

Ein Service von Reinhard Neidl - Webprogrammierung.

Das Verhalten von PHP beeinflussen

<<Das Verhalten von PHP beeinflussen



Alternativer PHP Cache

2 BenutzerBeiträge:
- Beiträge aktualisieren...
bugzilla33 at gmail dot com
6.09.2010 10:25

APC 3.1.4 does not work with files in PHAR archives.
phar:// stream wrappers including by require funcion are not cached.
hello at haroonahmad dot co dot uk
16.06.2009 12:57
Disclaimer: i do not guarantee it will work for you so you better use it at your own risk. It works for me.

* I am using # symbol for all shell commands

I am posting a quick step-by-step guide to install APC on servers (dedicated or VPS) with cpanel/whm working.

First login as a root to your server/vps and make a directory to work with this plugin,

#mkdir /home/APC-php

#cd /home/APC-php

now here we will first download the APC with following command


you can check for the latest version

now you can use gzip and tar separately or tar -xzvf to unzip this file

#tar -xzvf APC-3.0.14.tgz

now you will have a APC-3.0.14 folder.

#cd APC-3.0.14

now you have to make php configuration files by following command


after this use following three commands

# ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config

*if you do not know the php path then execute ( which php ) command it will display the path. on a typical cpanel vps it could be /usr/bin/php-config or /usr/local/bin/php-config but you better check it before executing the above command)


#make test

#make install

NOTE: if you are using suPHP then skip --with-apxs

*one more thing, if you use

#make test

command it shows 3 tests failed then do not worry, it showed at least to me but worked with the final steps.

the (make install) command will return the module path, note down that with you as you will have to feed it in the php.ini file in the next step.

check your php.ini location by

#php -i | grep php.ini

then open it with your favorite editor. mine was at

#vi /usr/local/lib/php.ini

and go to the last line and paste the following


now there is a catch in it, if you have other modules installed and their extension directory is different than the one MAKE INSTALL showed for APC so you have to move your to that directory so that all modules are in the same directory. in my case my APC directory was


but i moved from this location to my other location where my other files were.

you can check that path in php.ini sectiion of

extension_dir = ""

after this restart your apache, for different servers it may vary mine worked with

#service httpd restart

if everything works fine it will restart apache without showing any error. in case of any error, roll back your php.ini changes and restart apache and discuss your problem in some forum or email me at

now check the phpinfo() output in your browser and it will display APC version information etc. for command line you might do

php -i | grep apc

I hope it helps.

Haroon Ahmad

PHP Powered Diese Seite bei
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)