PHP is perhaps the most popular website building language among Linux developers, and is also a language available to programmers on other platforms. PHP is fully supported, fast and quite flexible.
However, PHP has a flaw. Because PHP is a scripting language, it can be edited before any specific idle script is executed. But with most modern systems being able to do so quickly these days, it's always a good thing to get the one with the best performance that stands out in the network.
Alternative PHP Cache (APC) is an open source cache tool for PHP that can hide edited scripts. So for later commands, PHP can only re-edit the script if it has changed.
But this only results in modest performance gains on some scripts, and may make more sense for more complex scripts. Unlike some of its competitors, APC is open source and widely available. You can download the source code from the APC website.
A free commercial version is also available: Zend Optimizer for Zend. (Zend is the company that writes the engine PHP, the editor script.) However, independent reports have published that APC's gains are more meaningful than those of Zend's optimizers.
Installing APC is very convenient; as long as you download the source code of APC, there is no need to configure anything else to make it work outside the box. The latest version is 2.0.4. Perform the following operations to install APC:
# tar xvzf APC-2.0.3.tgz
# cd APC-2.0.3
# /usr/bin/phpize
# ./configure --enable-apc
# make
# make install
if your PHP The installation is not under /usr. You must call phpize from the bin/ directory under your installation directory. For example, if you have installed PHP under /usr/local/php, you need to execute /usr/local/php /bin/phpize.
Next, use a text editor to edit the php.ini file (usually /etc/php.ini) and add the following content to the end:
extension="/usr/local/php/lib/php/extensions/no- debug-non-zts-20050922/apc.so"
save the file and restart Apache. Then, create a file called info.php somewhere in your network tree, including the following:
<?php phpinfo(); ?>
Open this page in your browser. You'll see part of the APC on the output. You can now use APC to speed up your PHP scripts.