Turck MMCache for PHP
=====================

What is Turck MMCache?
----------------------
Turck MMCache is a opcode cache for PHP. It increases performance of PHP
scripts by caching them in compiled state, so that the overhead
of compiling is almost completely eliminated. Also it uses some optimizations
for speed up of PHP scripts execution. Turck MMCache typically reduces server
load and increases the speed of your PHP code by 1-10 times.

Turck MMCache stores compiled PHP scripts in shared memory and execute code
directly from it. It creates locks only for short time while search compiled
PHP script in the cache, so one script can be executed simultaneously
by several engines. MM shared memory library (http://www.engelschall.com/sw/mm/)
is used for management of shared memory and locking.
Files those can't fit in shared memory are cached on disk.

Turck MMCache was first launched in 2001 for speedup
of www.guestbooks4all.com service. It has been tested with PHP 4.1.0 - 4.3.1
under Linux and Windows with Apache 1.3 and 2.0.
Patches for ports to other OSs PHP versions are welcome.

Turck MMCache is not compatible with Zend Optimizer.

Here are some other products that provide the same functionality 

 - Zend Performance Suite (http://www.zend.com/)
 - PHP Accelerator (http://www.php-accelerator.co.uk/)
 - Alternative PHP Cache (http://apc.communityconnect.com/)
 - AfterBurner Cache (http://www.bwcache.bware.it/)

What is TurckSoft?
------------------
TURCK SOFTWARE ST. PETERSBURG was founded in August 1998 as a branch of German
Corporate Headquarters Turck GmbH Munich, Germany, the leading provider of
IT-solutions in building-investment software in Germany. The main goal
of TURCK SOFTWARE ST. PETERSBURG foundation was to develop the laborious and
complex finance-analysis systems, using Russian labour market. The significant
prerequisites of it were the reliability and the most precision in terms and
as the consequence - the highest quality of our software.
Today TURCK SOFTWARE ST. PETERSBURG is an independent enterprise
(main shareholder: Helmut Turck), which works mainly for customers
from the German bank and insurance branch.

Company address:

Address: Turck Software St. Petersburg, ul.Stremiannaia, 16,
         191025 Saint-Petersburg, Russia
Phone:   +7(812) 112-01-20
Fax:     +7(812) 167-10-86

Where is Turck MMCache already used?
------------------------------------
The following you will find a list of sites that use Turck MMCache
If you want to be added, please send e-mail to mmcache@turcksoft.ru

 - www.guestbooks4all.com (http://www.guestbooks4all.com)

Latest News
-----------
2003-03-17 Turck MMCache version 2.3.8 is released.
           - some bugs were fixed
           - new optimisations were added
           - temporary memory usage was improved
           - shared memory usage was improved
2003-03-06 Turck MMCache version 2.3.7 is released.
           - files those can't fit in shared memory cached on disk
             (see "mmcache.cache_dir" directive)
           - proper handling of "include_path" directive
           - added some new optimizations
2003-02-28 Turck MMCache version 2.3.6 is released.
           - fixed some optimizer bugs
           - fixed caching classes those extend internal ones
2003-02-25 Turck MMCache version 2.3.5 is released.
           - added new configuration directive "mmcache.shm_size"
           - implemented memory info for Windows version
           - improved shared memory usage
           - added some new optimizations
           - fixed some optimizer bugs
           - tested with PHP 4.3.1

2003-02-13 Turck MMCache version 2.3.4 is released.
           - crash detection
           - shared memory overflow detection
           - new peephole optimization patterns
           - fixed some optimizer bugs

2003-01-30 Turck MMCache version 2.3.3 is released.
           - Apache 2 support implemented
           - Module globals now thread safe
           - Better shared memory usage
           - Fixed bugs in mmcache.php 
           - Fixed bugs in config.m4 script
           - Tested witn Apache 2.0.40 and PHP 4.2.2 on RedHat Linux 8.0

2003-01-23 Turck MMCache version 2.3.2 is released.
           - Fixed some optimization bugs.

2003-01-13 Turck MMCache version 2.3.1 is released.
           - Fixed some optimization bugs.
           - Better support of function and class runtime declaration
             implemented.
           - Tested with PHP 4.3.0

2002-12-20 Turck MMCache version 2.3.0 is released.
           - Now it works with PHP 4.2.3 under Linux and Windows.

2002-12-09 Turck MMCache version 2.2.0 is released under GPL

Download
--------
Latest Turck MMcache versions can be downloaded at the http://sourceforge.net/project/showfiles.php?group_id=69426

Requirements
------------
  apache 1.3, mod_php 4.1, libmm 1.1, autoconf, automake, libtool, m4

Compatibility
-------------
This version of the Turck MMCache has been successfully tested on PHP
4.1.0-4.3.1 under RedHat Linux 7.0, 7.3, 8.0 and Windows
with Apache 1.3 and 2.0.

Quick install
-------------
Step 1. Compiling Turck MMCache

  phpize
  ./configure --enable-mmcache=shared
  make

Step 2. Installing Turck MMCache

  make install

Step 3. Configuring Turck MMCache

Turck MMCache can be installed both as Zend or PHP extension, so you need
to edit your php.ini file (usually /etc/php.ini).

For installing as Zend extension:

  zend_extension="/usr/lib/php4/mmcache.so"
  mmcache.shm_size="16"
  mmcache.cache_dir="/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""

For installing as PHP extension:

  extension="mmcache.so"
  mmcache.shm_size="16"
  mmcache.cache_dir="/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""

Step 4. Creating cache directory

  mkdir /tmp/mmcache
  chmod 0777 /tmp/mmcache

Windows Installation Notes
--------------------------

To build Turck MMCache on Windows platform ypu will need
MS Visual Studio C++ 6.0.

Step 1. Compiling Turck MMCache
  - Unpuck php sources.
  - Put mmcache sources under "ext/mmcache".
  - Put "php4ts.lib" into "ext/mmcache".
  - Copy "main/config.w32.h.in" into "main/config.w32.h".
  - Open project file "ext/mmcache/mmcache.dsp".
  - Select release configuration and build "mmcache.dll".


Step 2. Installing Turck MMCache
  Copy "mmcache.dll" into your PHP extension folder

Step 3. Configuring Turck MMCache
  Add the following lines into your "php.ini" file (usually "c:\winnt\php.ini")

  zend_extension_ts="c:\fullpathtommcache\mmcache.dll"
  mmcache.shm_size="16"
  mmcache.cache_dir="c:\tmp\mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""

Step 4. Creating cache directory

  mkdir c:\tmp\mmcache

Configuration Options
---------------------

mmcache.shm_size
    The amount of shared memory (in megabytes) that Turck MMCache will use.
    "0" means OS default. Default value is "0".

mmcache.cache_dir
    Files those can't fit in shared memory will be cached in this directory.
    Default value is "/tmp/mmcache".

mmcache.enable
    Enables or disables Turck MMCache. Should be "1" for enabling or
    "0" for disabling. Default value is "0".

mmcache.optimizer
    Enables or disables internal peephole optimizer which may speed up code
    execution. Should be "1" for enabling or "0" for disabling.
    Default value is "1".

mmcache.debug
    Enables or disables debug logging. Should be "1" for enabling or
    "0" for disabling. Default value is "0".

mmcache.check_mtime
    Enables or disables PHP file modification checking. Should be "1"
    for enabling or "0" for disabling. You should set it to "1" if you want
    to recompile PHP files after modification. Default value is "0".

mmcache.filter
    Determine which PHP files must be cached. You may specify the number of 
    wildcards (for example "*.php *.phtml") which specifies to cache or
    not to cache. Default value is "" that means what all PHP scripts will be
    cached.

WEB interface
-------------
Turck MMCache can be managed through web interface script mmcache.php.
So you need to put this file on your web site. For security reasons it is
recommended to restrict the usage of this script by your local IP.

Contact us
----------
To contact us with questions, patches or bugs, please send e-mail to
mmcache@turcksoft.ru
