CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

7. PHP extensions

There are many different extensions available for php, which can be added in your php.ini

7.1. APC (Alternative PHP-cache)

7.1.1. What is APC

 

APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for compiling and caching php scripts. APC was conceived of to provide a way of boosting the performance of PHP on heavily loaded sites by providing a way for scripts to be cached in a compiled state, so that the overhead of parsing and compiling can be almost completely eliminated. There are commercial products which provide this functionality, but they are neither open-source nor free. Our goal was to level the playing field by providing an implementation that allows greater flexibility and is universally accessible. We also wanted the cache to provide visibility into it's own workings and those of PHP, so time was invested in providing internal diagnostic tools which allow for cache diagnostics and maintenance. Thus arrived APC. Since we were committed to developing a product which can easily grow with new version of PHP, we implemented it as a zend extension, allowing it to either be compiled into PHP or added post facto as a drop in module. As with PHP, it is available completely free for commercial and non-commercial use, under the same terms as PHP itself. APC has been tested under PHP 4.0.3, 4.0.3pl1 and 4.0.4. It currently compiles under Linux and FreeBSD. Patches for ports to other OSs/ PHP versions are welcome.

 
--www.apc.communityconnect.com/ 

The author made some performance-Tests with apc and it was real surprise. A PHP-Webpage with MySQL-queries in a loop (total 10 queries) was more than 50% faster

Contra APC: If you have other users on the system coding php they maybe are not comfortable with APC, because the changes are all ignored unless you reset the cache or restart Apache. The other way, namely that APC checks the php-script for a newer version before every run costs speed.

7.1.2. Download the source

Origin-Site: http://apc.communityconnect.com/sources/apc-cvs.tar.gz

7.1.3. Building and installing

cd /usr/local

tar -xvzf apc-cvs.tar.gz

cd apc

./configure --enable-apc --with-php-config=/usr/local/bin/php-config

make
make install

cp modules/php_apc.so /usr/local/lib/php/extensions

echo 'zend_extension="/usr/local/lib/php/extensions/php_apc.so"' \
>> /usr/local/lib/php.ini
echo “apc.mode = shm” >> \
apc.mode = shm

Restart your Apache-Webserver. Try it out, create a php-file with the following content:

Example 7. apctest.php

<?php
apcinfo();
?>

7.2. Zend-Optimizer (Do _NOT_ combine with APC-Cache!)

7.2.1. What is Zend-optimizer

 

The Zend Optimizer goes over the intermediate code generated by the standard Zend run-time compiler located in the Zend Engine, and then optimizes it for faster execution.

 
--www.zend.com 

Zend-Optimizer is a freeware closed source product. On the same testcode used for the APC-test, there was speed-decrease of about 5% compared to PHP without APC.

You have to make your own test, to see, if you have some improvements with your own code. Be sure not to NOT use Zend Optimizer together with APC, or your whole setup will not work.

7.2.2. Download the binary

Origin-Site: https://www.zend.com/store/free_download.php?pid=13

TipRegister at zend.com
 

You have to register yourself at zend.com to get access to the download-page

7.2.3. Installing

There is noting to build, this product is closed-source and so only available as binary for different platforms. The filename varies according your platform, the sample is for Linux on IA32.

cd /usr/local

tar -xvzf ZendOptimizer-2.1.0-Linux_glibc21-i386.tar.gz
	 
cd ZendOptimizer-2.1.0-Linux_glibc21-i386

./install.sh

The install script is self-explanatory, if you compiled Apache and PHP like described in this document, you can just press ENTER on all questions about the pathnames.