There are different extensions available for php, which could be added in your php.ini
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.
From the authors point of view:
The author made some performance-Tests with apc and it was really surprising. A PHP-Webpage with mysql-queries in a loop (total 10 queries) its speedup more that 50%
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, that APC checks the php-script for a newer version befor every run costs speed.
cd /usr/local tar -xvzf apc-1.1.0pl1.tar.gz cd apc-1.1.0pl1 ./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:
<?php apcinfo(); ?>
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.
From the authors point of view: there is a speed-decrease of about 5% ? Why using this closed-source but freeware-product?
You have to make your own test, to see, if you have some improvements with your own code. Be sure to NOT use Zend Optimizer together with APC, or your whole setup will not work
You have to register yourself at zend.com to get access to the download-page
There is noting to build, this product is closed-source and so only available as binary for different platforms. The filename is vary according your platform, the sample is for Linux on IA32
cd /usr/local tar -xvzf ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz cd ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz cp ZendOptimizer.so /usr/local/lib/php/extensions echo 'zend_optimizer.optimization_level=15' >> /usr/local/lib/php.ini echo'zend_extension="/usr/local/lib/php/extensions/ZendOptimizer.so"'>> /usr/local/lib/php.ini