DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Upgrade Typo3 3.8.0 to 4.2.0 (and PHP 4 to PHP 5)

Created:

2008-05-27T09:49:31

Changed:

2008-05-27T10:20:03

Classification:

Typo3 Tutorial

Description:

Upgrade Typo3 3.8.0 to 4.2.0 (and PHP 4 to PHP 5)

Author:

Marco Voegeli

Contact:

http://contact.voegeli.li

Copyright:
  1. 2008, Marco Voegeli, Switzerland / Europe
Web:

http://www.voegeli.li

Extension: mv_typo3_load_control

(Backend module to prevent request overload of your server!)

img-1

Extension Key: mv_typo3_load_control

Copyright 2008, Marco Voegeli, Switzerland / Europe

Web: http://www.voegeli.li / Contact: http://contact.voegeli.li

This document has been published under the Open Content License:

http://www.opencontent.org

This document is not an official document from the Typo3 Association (see Disclaimer).

The content of this Tutorial is related to the Open Source Content Management System called „TYPO3“

http://typo3.org

Table of contents

Extension: mv_typo3_load_control 1

Disclaimer 2

Introduction 2

What is this document for? 2

What is the target group? 2

Any Hints or Suggestions? 2

Requirements 2

Architecture 3

Configuration in Backend 3

Load Control Functionality 3

Installation & Configuration 4

  1. Installation 4
  2. Create a system storage folder 4
  3. Create Configuration Record 5
  4. Create Exclude Records 6
  5. Create Frontend Message Records 8
  6. Settings in your backend module 9

Check Installation & Configuration 11

Check current configuration 11

Create Loads 11

Check if loads are recorded 12

Disclaimer

  • This document is NOT an official document from the TYPO3 association.
  • The use of this extension, as mentionned in this document, is on your own risk. The author and the Typo3 association cannot be responsible for anything that results out of this.
  • Please also check the official publications on typo3.org, the relevant change logs and forums.
  • If you feel insecure or you do not have the specific knowledge to perform the necessary steps please contact a Typo3 consulting partner.
  • **There is no free consulting given by the author for this tutorial or the use of this extension!**

Introduction

What is this document for?

This tutorial belongs to the Typo3 extension „mv_typo3_load_control“. This extension allows you to control the number of requests sent to your site, beforeTypo3 has been executed. It makes sense, if you have a website with many SQL queries or a low performance server (like many public webhosting provider do have). Thisextension consists of a backend module and a frontend PHP-file. I had to develop this extension for my own, because my site generated too much traffic. After a trace i found out, that Typo3 generated over 100 SQL-queries, which were the reason for the low performance. Now there is a check of how many requests Typo3 will execute, which is only about 3 SQL-queries. After using this extension now for about 1 month I never had problems again.

What is the target group?

This document is addressed to Typo3 administrators and developers. But it is quite simple to use it – so almost everyone will be able to use it.

Any Hints or Suggestions?

If you have any hints or suggestions (not basic questions), you may send them to me (see contact data in the document header) or: http://contact.voegeli.li

Requirements

Before you start, be sure that your installation meets the following requirements:

  • Typo3 installed & running
  • FTP-access to the Typo3 root directory

Architecture

Here you can find the architecture of this solution in a picture and explained:

img-2

Configuration in Backend

You can easily configure the Load Control in a backend module, delivered with the extension. Further configuration can be done with records.

Load Control Functionality

Usually Typo3 receives requests directly from the web – without a load control.

With this extension the first receiver of the requests is not Typo3, but the load control frontend part. This will be executed quicker than Typo3 and will decide if the request can be forwarded to Typo3 or not. Here the server overload is being prevented.

Installation & Configuration

Here you find the detailed tutorial, how to install and configure the extension.

1. Installation

Import the extension „ mv_typo3_load_control “ from Typo3 extension repository and install the extension (with your extension manager in your backend).

2. Create a system storage folder

Go to your backend and create a new page of type „SysFolder“.

img-3

img-4

3. Create Configuration Record

Go to your backend, go to „List“ module, select your created folder „TYPO3_Load_Control_Storage“. Create a new record of type „TYPO3 Load Control – Configuration“.

img-5

Fill in the configuration parameters.

img-6

Load Control Active?

If checked, the logic is active. If not, Typo3 will be executed as normal, without a load control check first.

Maximum number of current visitors

How many different visitors do you want to allow on your site at the same time? If you just want to control reload intervals and not maximum number of users, then simply set this to very high.

Session Lifetime in seconds

How long should a visitor session be kept alive?

Min. Interval reload 1 to 2 in sec.

Minimum time interval in seconds from the first page load of a visitor to the second. (Only used once per visitor)

Min. Interval reload 1 to N in sec.

Minimum time interval in seconds from first load to load 3 and every following, with one reload interval.

Storage folder ID

The number of the storage folder you have created.

IMPORTANT

Create only 1 record of this type within 1 Typo3 installation!

4. Create Exclude Records

You can exclude specific visitors, such as google bot. If you define them to be excluded, the load control logic won't be active for them and they can load as much as they want.

Exclude high traffic bots before, via htaccess

Most of the traffic to my site was generated by yahoo bots! This was really terrible. So the best way to exclude „bad“ robots is to place something like the following to your „.htaccess“ file. This will not even let them to the load control.

order allow,deny

deny from .yahoo.net

deny from .yahoo.com

deny from .live.com

deny from .crawl.yahoo.net

deny from .search.live.com

deny from internetserviceteam.com

deny from .internetserviceteam.com

deny from crawl.yahoo.net

deny from crawl.yahoo.com

deny from search.live.com

deny from *yahoo.net

deny from *yahoo.com

deny from *live.com

deny from 65.55.

deny from 74.6.

deny from 67.195.

allow from all

Hint: Do allow google bots to visit your site. The don't generate such a high traffic and indexing is important to kep your site in the search results. So create an exclude record for google.

img-7

Go to the list module, to your storage folder and create a new record of type „TYPO3 Load Control – Exclude“.

Fill in the parameters as follows.

img-8

Exclude Active?

If checked, exclude will work. If not checked, exclude is not taken into the logic.

Exclude String

A whole host name, part of a hostname, a whole IP or a part of a IP.

(ex. „google“ -> will exclude all hosts containing %google%)

5. Create Frontend Message Records

When visitors exceed their reload limits or too many visitors try to load your site, then these messages appear, instead of your Typo3 site. The messages can be maintained in different languages.

Go to the list module, to your storage folder and create a new record of type „TYPO3 Load Control – Messages“.

img-9

Browser Language

This is not the Typo3 browser language! This is the PHP browser accept language. Examples are:

  • „en-us“ english american
  • „en-gb“ english british
  • „de-ch“ swiss german
  • „de“ german
  • ...

You can set 1 record with language = „default“. This one then will be taken, if the specific language message record is not set. You can also just maintain 1 record with language = “default“ and put an english and german message into the same record.

In the folder res/test you find the script test.language.ph, which shows your browsers accept languages.

Message ID

Not used now. Set always to 1!

Message Text

The message, which is shown. You can use HTML if you want.

img-10

6. Settings in your backend module

Now go to your backend and open the backend module „Load Control“:

img-11

Choose „ 2) Edit and check external DB connection“.

Edit the parameters host, password, user and database and press button „Save Configuration“. After you have pressed that button, the backend module tries to establish a database connection with your parameters and shows the protocol right below the editable box. If the two lines are green, the settings are okay!

If you cannot edit the file here, edit the file „res/class.database.settings.php“

Why an external database connection and not the one of Typo3?

Because the frontend part is being executed before Typo3 establishes a DB connection!

The only manual step:

Now download the Typo3 index.php file from your Typo3-root-Directory (via FTP).

img-12

Place the line...

include_once("typo3conf/ext/mv_typo3_load_control/res/typo3_load_control.php");

...directly after the „<?php“ tag in the index.php file.

Then upload this index.php to your Typo3-root-directory (via FTP.)

Check the inclusion over your backend module „Load Control“ -> point „3) Check index.php“

Now your installation and Configuration is done. Proceed to the next chapter to see how to check if it works or not!

Check Installation & Configuration

Check current configuration

Go to your backend module „Load Control“ and select point „5) Current configuration“:

Check if records are available and parameters are set right.

Create Loads

Call your Typo3 site several times with your browsers refresh button. If you reload too fast now, your messages should appear!

Check if loads are recorded

Go to your backend module „Load Control“ and select point „4) Current online user“.

Here you see a report of all current users on your websites. You can also see the visitors as records in your storage folder:

That's it. I hope this extension works for you as well as it does for me. It prevented that I had to move my web account to another provider!

:-) Open source forever!

TYPO3 Load Control (mv_typo3_load_control) - 12