PDA

View Full Version : HowTo: Install Turck MMCache



jmstacey
07-10-2004, 02:52 AM
NOTICE: TurckMMCache will probably not work with newer versions of PHP. I recommend eAccelerator (http://eaccelerator.net/HomeUk) which was forked from TMMC.

This HowTo has been only been tested on FreeBSD 4.x but should work for all Operating Systems with the required tools.

Required Tools
apache 1.3.xx
mod_php
autoconf
automake
libtool
m4


1. Download Turck MMCache, extract it and cd into it
wget http://aleron.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.4.6.tar.gz
tar -zxf turck-mmcache-2.4.6.tar.gz
cd turck-mmcache-2.4.6


2. Locate php and find where its installed
which php
Example Output: "/usr/local/php" ignore the /php, all we want is the prefix to the php
directory. In my case it was "/usr/local"
*All commands that are purple denote where you should substitue your
php prefix


3. Create the configure files using the php prefix from the previous step
/usr/local/bin/phpize

4. Compile Turck MMCache.
./configure --enable-mmcache=shared --with-php-config=/usr/local/bin/php-config

make
make install


If there were no errors and it appeared to compile successfully please note where it put mmcache.so and we'll move on to the next step.

5. Configure Turck MMCache
I assume you are going to use Turck MMCache as a zend extension, as such the following reflect
that. You can use it as a php extension by removing the zend from the first line "zend_extension...." but
I haven't messed with that.

Edit your php.ini file and add the following right above the Zend entries.
It is very important to add it ABOVE the zend configurations otherwise nothing will work.

[mmcache]
#the location of mmcache.so will vary on your installation
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=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"


6. Create the cache directory
mkdir /tmp/mmcache
chmod 0777 /tmp/mmcache

7. Test and make sure its working by placing the mmcache.php file in a publicly accessible location and try to access it from the web. If it works it will display a information page similar to the php info page.

Recommended -- Since you control Turck MMCache through the mmcache.php file, its probably not the best idea to allow the entire world access to it.
Move the mmcache_password.php file to a publicly accessible location and access it. Fill in a username and password and do what it tells you when it generates the key (You'll have to edit your php.ini file again ;) )

After you have completed that, try accessing the mmcache.php file and make sure it requires authentication to access it, if so you can delete the mmcache_password.php and turck-mmcache-2.4.6[/b] directory at tar.

Troubleshooting
If you get a configure error on step #4 like error: tag name "CXX" already exists
Open the configure file and search for the following two entries


tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`
tagnames=`echo "$tagnames,F77" | sed 's/^,//'`
and comment them out (put a # in front of them)

Please notify me if something doesn't work :)

Dr-Host
07-10-2004, 05:34 PM
It's a great tool I got it on my RH9 works great

Thafusion
07-18-2004, 03:15 PM
2. Locate php and find where its installed
which php
Example Output: "/usr/local/php" ignore the /php, all we want is the prefix to the php
directory. In my case it was "/usr/local"
*All commands that are purple denote where you should substitue your
php prefix


3. Create the configure files using the php prefix from the previous step
/usr/local/bin/phpize

4. Compile Turck MMCache.
./configure --enable-mmcache=shared --with-php-config=/usr/local/bin/php-config


i did this :
hercules# which php
/usr/local/bin/php

i don't understand step 3 and when i whant to do step 4 i get :


hercules# ./configure --enable-mmcache=shared --with-php-config=/usr/local/bin/bin/php-config
./configure: Command not found.

jmstacey
07-18-2004, 11:37 PM
Step 3 runs phpize which creates the configure files so you can continue.
Did you sucessfully run that command in the turck mmcache directory?

Thafusion
07-19-2004, 05:19 AM
hercules# php prefix /usr/local/bin/bin/phpize
Could not open input file: prefix.


Something like this ?

jmstacey
07-19-2004, 08:33 PM
no, the php prefix IS /usr/local/bin

so you use prefix/phpize which would be:



/usr/local/bin/phpize

iotc247
09-13-2004, 05:07 PM
I get


[root@serv1 turck-mmcache-2.4.6]# phpize
configure.in:65: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.

Whenever i run the phpize command.. Whats wrong. I have zend installed..

jmstacey
09-15-2004, 01:40 PM
You might want to make sure you have all the required tools installed properly, or reinstall the latest versions.

Also, did you try using the m4_pattern_allow thing?

iotc247
09-15-2004, 02:37 PM
If i knew what that means and what i need to do to use it i probably wouldnt get that error..

blueice
11-04-2004, 11:13 AM
Hi,
i have run:
/usr/local/bin/phpize
and i have the error:
aclocal: not found

I use freebsd 4.10
any help?
Christos

Thafusion
01-06-2005, 02:28 PM
Ok few month later new install of Fedora core 2 with php 4.3.10

[root@web eaccelerator]# which php
/usr/local/bin/php

[root@web eaccelerator]# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/bin/php-config
-bash: ./configure: No such file or directory

eaccelerator are some developer that are using the last version of mmcache . I have the same errors with mmcashe

hackerpitbull
01-07-2005, 07:40 AM
thx but i can't find where to put it in php.ini and i can't find mmcache.php and mmcache_password.php...

it supports php5?

jmstacey
01-07-2005, 11:01 PM
Originally posted by blueice
Hi,
i have run:
/usr/local/bin/phpize
and i have the error:
aclocal: not found


Make sure you have all the necassary build tools required such as automake and so on.


Thafusion: Make sure you have the latest release of TurckMMCache from the official TurckMMCache website and that you are in the correct directory.


hackerpitbull: As far as I know, the last release of TurckMMCached did not support php5.
The .php files should have been located somewhere in the extracted mmcache directory.

hackerpitbull
01-08-2005, 04:01 AM
Originally posted by jmstacey
hackerpitbull: As far as I know, the last release of TurckMMCached did not support php5.
The .php files should have been located somewhere in the extracted mmcache directory. [/B]
i use php5 blah =\

NissimC
02-05-2005, 04:40 AM
Thanks for the guide!
I got it installed on my Fedora 2 Server.

But.. I have one problem.
Where is the mmcache.php file is located?
I tried to do "locate mmcache.php",
but i didnt find anything.

I want to see that this installed on my system,
because I dont want to use ionCube again :(.

Edit:
I found mmcache.php.
It's on the folder that i decompressed/turck-mmcache-v.e.r/mmcache.php

ja3
02-05-2005, 10:05 AM
Thanks for your tutorial. But I have one problem, it conflicts with my ioncube encoder extension.

If I disable it, it still won't work. So how can I only load it if ioncube is not needed?

Thanks,
ja3

If you have PHP5 try www.eaccelerator.net

hackerpitbull
02-05-2005, 11:11 AM
Originally posted by ja3
Thanks for your tutorial. But I have one problem, it conflicts with my ioncube encoder extension.

If I disable it, it still won't work. So how can I only load it if ioncube is not needed?

Thanks,
ja3

If you have PHP5 try www.eaccelerator.net
"This version of the eAccelerator has been successfully tested on PHP
4.1.0-4.3.3 under RedHat Linux 7.0, 7.3, 8.0 and Windows with Apache 1.3
and Apache 2.0."

NissimC
02-05-2005, 11:21 AM
Yair(I know you from Hosts), I'll open a VPS on my server and test it for you.
If it working, I'll update here in a new theard, because this theard is for Turck MMCache only.

ja3
02-05-2005, 12:22 PM
2004/12/20 - eAccelerator 0.9.1
eAccelerator 0.9.1 is available for Download. Should be PHP5 ready, but we need yours feedbacks.

hackerpitbull
02-05-2005, 01:57 PM
Originally posted by ja3
2004/12/20 - eAccelerator 0.9.1
eAccelerator 0.9.1 is available for Download. Should be PHP5 ready, but we need yours feedbacks.
well m8 bcz i use my server for a hosting biz - i can't use unstable version. thx anyway :)

Chrysalis
02-06-2005, 09:26 AM
nothing unstable about, if anything should be more stable since its patched up some bugs.

Newbee
03-07-2005, 05:00 PM
Can someone please do a 'how to' for eaccelerator as well pleas? (http://eaccelerator.net/HomeUk/)

Or point me in the right direction if there already is one - cheers!

noose
03-10-2005, 02:03 PM
Hi !
System: FreeBSD 4.10

Problem:

server# ./configure --enable-mmcache=shared --with-php-config=/usr/local/bin/php-config
checking build system type... i386-unknown-freebsd4.10
checking host system type... i386-unknown-freebsd4.10
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... yes
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20020429
checking for [...]
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
./ltconfig: ./ltconfig: No such file or directory
configure: error: libtool configure failed


I must change something??

Chrysalis
03-15-2005, 09:59 AM
I couldnt get turk mmcache to install on freebsd but eacellerator installs fine.

Thafusion
12-30-2005, 12:03 PM
It worked i just recompiled apache and php and i also redid the same steps to install mmtrunk but it isn't working the mmtruck.php file say;s now nothing installed



turck-mmcache-2.4.6

export PHP_PREFIX="/usr/local"

$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install

nano /usr/local/lib/php.ini
set extension_dir to /usr/local/lib/php/extensions/no-debug-non-zts-20020429/


Add this at the bottom

extension="mmcache.so"
mmcache.shm_size="32"
mmcache.cache_dir="/tmp/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="0"

Chrysalis
12-31-2005, 11:28 AM
you realise eaccellerator replaces mmcache which is now a long time dead project.

jmstacey
12-31-2005, 06:13 PM
I concur.

I'll update my post with a recommendation.

torp
01-20-2006, 01:11 AM
Originally posted by Newbee
Can someone please do a 'how to' for eaccelerator as well pleas? (http://eaccelerator.net/HomeUk/)

Or point me in the right direction if there already is one - cheers!
It's pretty much exactly the same. Just change turck-mmcache to eaccelerator, wherever it occours.

Complete install guide can be found here. http://eaccelerator.net/SourceInstallationUk - worked well for my DA box with RH9

torp
01-20-2006, 01:14 AM
What does memory size do? I have a PHP heavy server, with a few thousand scripts, and this memory gets filled up to 16MB after about 30 seconds. Any guidelines on what size this should be, or how this affects performance?

I don't know exactly how eAccelerator works, but looking at my PHP scripts, and the size of output they generate, I would probably think that eAccelerator's cache should be closer to 16GB than 16MB, if all PHP scripts are to be cached.

torp
01-21-2006, 02:53 AM
I have struggled with this for ages now. Both turck-mmcache and eAccelerator segfaults approx. twice a day. Here's the error from httpd/error_log:
[Sat Jan 21 10:35:17 2006] [notice] child pid 27390 exit signal Segmentation fault (11)
This happens both with turck and eAccelerator, using PHP 4.3.10 and Apache 1.3.33, and older versions.

Does anyone know why this segfaults? I am using the default values for eAccelerator in php.ini.

Anyone suggest I should disable Zend?

torp
01-21-2006, 11:20 AM
Sorry for using a post replying to myself. But if anyone wonders, I'm using the following settings for my php.ini and it seems to be working well. I think the problem might have been that the cache filled up quickly and old files were not removed. I have a good few thousand PHP scripts on the server, and they're quite heavy.

Here are the settings I'm using:

zend_extension="/root/eaccelerator-0.9.3/modules/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="4M"
eaccelerator.shm_ttl="1800"
eaccelerator.shm_prune_period="1800"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

LiquidAtoR
01-24-2006, 03:02 PM
running php 4.4.2 with mmcache 2.4.6 installed, no probs whatsoever.
Just recompiled everything, and added the settings to php.ini again.