 |
|
|
How To Install Turck MMCache
Last
Updated:
November 30, 1999
What is Turck MMCache?
Turck MMCache is a free open source PHP accelerator, optimizer, encoder and dynamic content 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 to speed up execution of PHP scripts. 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/) was used by Turck MMCache before version 2.3.13 for management of shared memory and locking. Files those can't fit in shared memory are cached on disk only.
Turck MMCache was first launched in 2001 to speed up the www.guestbooks4all.com service. It has been tested under PHP 4.1.0-4.3.3 under GNU/Linux and Windows with Apache 1,3 and 2.0. Patches for ports to other OSs and PHP versions are welcome
Since version 2.3.10, Turck MMCache contains a PHP encoder and loader. You can encode PHP scripts using encoder.php in order to distribute them without sources. Encoded files can be run on any site which runs PHP with Turck MMCache 2.3.10 or above. The sources of encoded scripts can't be restored because they are stored in a compiled form and the encoded version doesn't contain the source. Of course, some internals of the scripts can be restored with different reverse engineering tools (disassemblers, debuggers, etc), but it is not trivial.
Since version 2.3.15, Turck MMCache is compatible with Zend Optimizer's loader. Zend Optimizer must be installed after Turck MMCache in php.ini. If you don't use scripts encoded with Zend Encoder then we do not recommend you install Zend Optimizer with Turck MMCache.
Turck MMCache does not work in CGI mode.
1. Login to your server as root via SSH
2. Type: cd /
3. Type: mkdir mmcache
4. Type: cd mmcache
5. Type: wget http://unc.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
6. Type: tar -xvzf turck-mmcache-2.4.6.tar.gz
7. Type: cd turck-mmcache-2.4.6
8. Type: export PHP_PREFIX="/usr"
OR
export PHP_PREFIX="/usr/local"
This depends on where PHP is installed
9. Type: $PHP_PREFIX/bin/phpize
10. Type: ./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
11. Type: make
12. Type: make install
13. Edit PHP.INI File (One of the below will work - if one is emtpy then use the other file)
Type: pico -w /etc/php.ini
or
Type: pico -w /usr/local/lib/php.ini
14. Find this:
;Windows Extensions
Above this line comment out the PHPA or the ZEND lines if they are there.
Replace them with the following:
For ZEND:
zend_extension="/mmcache/turck-mmcache-2.4.6/modules/mmcache.so"
mmcache.shm_size="16"
#^-This is the folder limit (16mb), you can make it larger if you wish.
mmcache.cache_dir="/home/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
OR for PHP Extensions
extension="/mmcache/turck-mmcache-2.4.6/modules/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/home/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
15. Now we need to create a cache directory.
16. Type: mkdir /home/mmcache
17. Type: chmod 0777 /home/mmcache
18. Restart Apache
Type: service httpd restart
19. Done - A list of supported scripts.
MMCache support enabled
Caching Enabled true
Optimizer Enabled true
Memory Size 33,554,392 Bytes
Memory Available 23,737,176 Bytes
Memory Allocated 9,817,216 Bytes
Cached Scripts 110
Removed Scripts 0
Cached Keys 0
When you upgrade PHP you need to completely re-install MMCache. You need to delete the whole directory, and re-install. |
|
 |
|