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.

Recompiling of packages and turning up the environment, required by Typo3

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2003-10-20T16:00:42
Author:Irina Grimpe-Lishchenko
Email:ilis@omnisolutions.de, ilis@lishchenko.de
Info 3:
Info 4:

Recompiling of packages and turning up the environment, required by Typo3

Extension Key: ilis_recompile_doc

Copyright 2000-2002, Irina Grimpe-Lishchenko, <ilis@omnisolutions.de, ilis@lishchenko.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

Recompiling of packages and turning up the environment, required by Typo3 1

Introduction 1

What does it do? 2

Recompiling freetype libraries 2

Recompiling of ImageMagick 2

Recompiling of gd library (gd library with gif support) 4

Recompiling of php4 (4.3.0) module for Apache web server 4

Some final steps 6

Summary 8

Introduction

This is already second version of this document and here we are assuming that we need adjust our packages for Typo3 on the SuSE Linux Server (version 8.1), with default installation of Apache and PHP

it was tested with Typo3 version 3.5.0 on SUSE Linux 8.1 apache-1.3.26 and PHP version 4.3.0 (but it should not be too many differences with other Linux OS, al least with SuSE 8 or 7.3, and with other PHP versions, which are close to 4.3.0).

The first version considered recompiling both of PHP and Apache and was tested with Typo3 version 3.5b4, 3.5.0 on SUSE Linux 8, 8.1 and 7,3, Apache-1.3.26 and several versions of PHP including 4.3.0. Then I did recompiling Apache in order my recompiled PHP can work. But it is very obvious, that we don't need to recompile Apache. It is absolutely enough recompilation of PHP.

Here I want to notice that recompiling of Apache in the sake of recompiling PHP only and without any other aim was not a very good idea. I just did not know how to avoid it. Default Apache installation already works with SSL and in case of recompiling we get another problem: how to set up SSL again (I am not a big master in security questions, but as I understand that is not so easy for a person without experience) or we simply loose SSL. I prefer don't loose anything what I already have, so here I want to describe recompiling PHP without Apache recompilation, as it was in first version

As a kind of help for installation and turning up the environment (php and other packages) can be taken the file installation_auf_suse8.pdf (author Carsten Rose, e-mail: carsten9@gmx.ch). It was mentioned earlier on mailing list with regards to the question of installation. I used this document too, but unfortunately I don't remember the link where I found it. There is much useful information. And I think it still can be found with the help of mailing list archive.

In any way I have faced my own difficulties when I followed it's instructions and most likely everybody will have their own. After several installation of typo3 with recompiling of PHP on different linux servers (but all of them SuSE Linux) it is very easy to see that each case is different because in each case we have a different set of preinstalled packages. That is why in each case there are different issues which we have to manage in order to make everything work the best way. You may don't face these problems at all or you can face other problems (depending on that what you already have preinstalled). I can only to share some of my own experience here with a hope that this can help to somebody.

What does it do?

  • So here I will try to separate the process of turning up the environment to the next steps:
  • recompiling of freetype libraries
  • recompiling of ImageMagick
  • recompiling of Gd Library with gif support
  • recompiling of PHP4 (4.3.0) module for Apache webserver
  • some final steps and remarks

Recompiling freetype libraries

Somewhere I have met the info, that it was recommended by typo3 community to use freetype-1.3.1, so if you have other one version (for example older one), then may be it's better to recompile it. Indeed this package is used by Typo's GIFBUILDER, therefore it must be able to work properly and has to be included as an parameter for configure command in ImageMagick and GD recompiling. In PHP recompiling itself there is no option pointing directly to this recompiled FreeType library, even more I excluded the default directive

--with-freetype-dir=yes

because it caused problems to me, as negative FreeType quick test in Typo3 backend install tool.

Necessary packages: In order to recompile it according to selected options of configure script (see below) you need the package xdevel to be installed.

Notice!Here and late with necessary packages I mean packages, without them it does not want to be recompiled. But please don't expect to find here a full list of necessary packages. Here is only a small tips which I have found doing it myself.

unpack the archive file

# gunzip < freetype-1.3.1.tar.gz |tar xvf -

or

# tar zxvf freetype-1.3.1.tar.gz

copy the folder freetype-1.3.1, that you have got after the 1st step to the destination location /usr/src/packages/BUILD

run next commands:

# cd /usr/src/packages/BUILD/freetype-1.3.1

# ./configure --prefix=/usr/local/typo3sh --exec- prefix=/usr/local/typo3sh --x-libraries=/usr/X11R6/lib

# make

# make install

check results

Recompiling of ImageMagick

By typo3 community is recommended ImageMagick version 4.2.9. According to opinion of gurus it works better and quicker as newer versions (5+) of ImageMagick.

Necessary packages: in order to get the next following IM configuration (as it is shown in the listing below) you need to have installed packages:

  • libpng
  • libpng-devel
  • zlib
  • zlib-devel
  • ghostscript-fonts-other
  • ghostscript-x11

If you have all these packages already installed you will see something like this listing with the last part of output, which is produced by configure script:

ImageMagick is configured as follows. Please verify that this
configuration matches your expectations.

Host system type : i686-pc-linux-gnu

Option            Configure option        Configured value
----------------------------------------------------------
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=yes           yes
GNU ld            --with-gnu-ld=no              yes
Ghostscript       None                          yes
LZW support       --enable-lzw=yes              yes
16 bit pixels     --enable-16bit-pixel=no       no
SFIO              --enable-sfio=no              no
SOCKS             --enable-socks=no             no
PERL              --with-perl=no                no
BZLIB             --with-bzlib=yes              yes
DPS               --with-dps=yes                yes
FlashPIX          --with-fpx=yes                no
HDF               --with-hdf=yes                no
JBIG              --with-jbig=yes               no
JPEG              --with-jpeg=yes               yes
PNG               --with-png=yes                yes
TIFF              --with-tiff=yes               yes
TrueType (TTF)    --with-ttf=yes                yes
TTF Path          --with-ttf-fontpath=          ""
ZLIB              --with-zlib=yes               yes
X11               --with-x=yes                  yes

X11 Configuration:
  X_CFLAGS     = -I/usr/X11R6/include
  X_PRE_LIBS   = -lSM -lICE
  X_LIBS       = -L/usr/X11R6/lib
  X_EXTRA_LIBS =

Final Compilation Flags:
  CC       = gcc
  CFLAGS   = -O
  CPPFLAGS = -I/usr/local/typo3sh/include/freetype -I/usr/X11R6/include -I/usr/X11R6/include/X11
  LDFLAGS  = -L/usr/local/typo3sh/lib -L/usr/X11R6/lib
  LIBS     = -ltiff -lttf -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lX11 -lz -lm
......................

Steps:

unpack the archive file

# gunzip < ImageMagick-4.2.9.tar.gz |tar xvf -

copy the folder ImageMagick-4.2.9, that you have got after unpacking, to the next destination location: /usr/src/packages/BUILD

Run next commands:

# cd /usr/src/packages/BUILD/ImageMagick-4.2.9
# ./configure --prefix=/usr/local/typo3sh --exec-prefix=/usr/local/typo3sh \
  --bindir=/usr/local/typo3sh/bin --enable-lzw \
  --includedir=/usr/local/typo3sh/include/freetype --without-perl \
  --enable-shared --libdir=/usr/local/typo3sh/lib

Possible issues:

Although --with-png=yes but it can give in result of configure command the next result:

PNG --with-png=yes no

Installing the package libpng-devel solves this problem and in result we get png support

PNG --with-png=yes yes

Then we can run the command make:

# make

Possible issues: here it's very possible getting the error:

/usr/X11R6/include/X11/Xarch.h:48:27: sys/byteorder.h: No such file or directory
make[1]: *** [animate.o] Error 1
make[1]: Leaving directory `/usr/src/packages/BUILD/ImageMagick-4.2.9'
make: *** [all-recursive] Error 1

The problem is in that, that the IM 4.2.9 expects to find byteorder.h file in the folder /usr/include/sys But in SuSE Linux this file is located in /usr/include/asmMaking a correspondent symlink sloves this error

# cd /usr/include/sys # ln -s ../asm/byteorder.h byteorder.h

At the end if everything is sucesfull we can make install

# make install

check results

Recompiling of gd library (gd library with gif support)

GD library with GIFsupport can be found on the Internet. For example, at the moment there is an actual link where you can find it http://www.rime.com.au/gd/. One of them I have used and it was gd-1.8.4 version with gif support.

Steps:

unpacking

# gunzip < gd-1.8.4gif.tar.gz |tar xvf -

copy the folder gd-1.8.4 we have got to the destination location /usr/src/packages/BUILD

change the current directory

# cd /usr/src/packages/BUILD/gd-1.8.4

and modify the first part of Makefile, part before the line " Changes should not be required below here."

It should be:

COMPILER=gcc
AR=ar
CFLAGS=-O -DHAVE_LIBXPM -DHAVE_LIBJPEG -DHAVE_LIBTTF -DHAVE_LIBPNG
LIBS=-lm -lgd -lpng -lz -ljpeg -lttf -lXpm -lX11
INCLUDEDIRS=-I. -I/usr/local/typo3sh/include/freetype -I/usr/include/X11 -I/usr/X11R6/include/X11
LIBDIRS=-L. -L/usr/local/typo3sh/lib -L/usr/lib/X11 -L/usr/X11R6/lib
PREFIX=/usr/local/typo3sh
#Location where libgd.a should be installed by "make install".
INSTALL_LIB=${PREFIX}/lib
#Location where .h files should be installed by "make install".
INSTALL_INCLUDE=${PREFIX}/include
#Location where useful non-test programs should be installed by "make install".
INSTALL_BIN=${PREFIX}/bin

run next commands

# make
# make install

check results

Some remarks about GIF support question. Do we need gif support or not? It is recommnded to have it but it is possible to live without it too

Every modern browser supports PNGs. Unless your site has to run on VERY old systems, there is no real reason for GIFs anymore. All current browsers also support transparency with PNGsOn the other hand these older browsers, that do not support PNG, are also very unlikely to support layers (for menus, for instance), some javascript and many other features that have become standard in todays www-development.So, why use GIF?Some people just don't like the idea of using a format which is copyrighted and might cause a lawsuit (ok, not yet in europe, but who knows what Gravenreuth goes for in the future...)

By the way, it was some information in C'T magazine (2003) that says something like this: since next year it will be allowed to use it free

Recompiling of php4 (4.3.0) module for Apache web server

Here we are assumining that default Apache has mod_so enabled. Check this using httpd -l. You should see something like:

# httpd -l
Compiled-in modules:
http_core.c
mod_so.c

The module mod_so should be part of the displayed list. So we recompile our php as Dynamic Shared Object. ( http://httpd.apache.org/docs/dso.html )

As we don't want to recompile Apache webserver ourselves we need apache-devel package to have installed. It includes apxs file ( http://httpd.apache.org/docs/programs/apxs.html ). Apxs means APache eXtenSion tool, and to be short it is necessary for PHP recompilation. At http://www.faqts.com/knowledge_base/view.phtml/aid/7664 you can find more explanations to it.

Necessary packages:

  • apache-devel
  • flex
  • bison
  • openssl-devel
  • curl-devel
  • gdbm-devel
  • libxml2-devel
  • xdevel
  • xshared
  • t1lib-devel
  • gettext
  • imap-devel
  • openldap2-devel
  • libmcrypt-devel
  • libiodbc-devel (see following remark)
  • mysql-devel
  • sablot-devel
  • readline-devel
  • postgresql
  • postgresql-devel
  • qt-devel
  • db
  • db-devel
  • freetype2-devel
  • pam
  • pam-devel
  • sablot 097 compiled form source (for PHP 4.3.0 it should be older as 096)
  • perl-XML-Parser (for Sablot)

If you meet an error like:

checking for PDFlib support... yes
checking for the location of libtiff... yes
checking for jpeg_read_header in -ljpeg... (cached) yes
checking for png_create_info_struct in -lpng... no
configure: error: libpng not found!

it can be caused by absence of package libiodbc-devel.I have no explanation to it, but having all other packages installed, and no libiodbc-devel among them, I got constantly the above named error

Steps:

Unpack und place the source of PHP into /usr/src/packages/BUILD/ or whatever location you use for this.

So, there is a configure command, which preserves maximum options from default rpm installation of php-4.2.2:

./configure --prefix=/usr/local/share --exec-prefix=/usr/local/share \
--libexecdir=/usr/local/share/libexec --datadir=/usr/local/share/php \
--bindir=/usr/local/bin --libdir=/usr/local/lib --sysconfdir=/usr/local/etc \
--with-config-file-path=/etc --with-exec-dir=/usr/local/lib/php/bin \
--disable-debug --enable-bcmath --enable-calendar --enable-ctype --enable-dbase \
--enable-discard-path --enable-exif --enable-filepro \
--enable-force-cgi-redirect --enable-ftp --enable-gd-imgstrttf \
--enable-gd-native-ttf --enable-inline-optimization --enable-magic-quotes \
--enable-mbstr-enc-trans --enable-mbstring --enable-memory-limit \
--enable-safe-mode --enable-sockets --enable-shmop --enable-sigchild \
--enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid \
--enable-versioning --enable-wddx --enable-yp --with-bz2  \
--with-dom=/usr/include/libxml2 --with-ftp --with-gdbm --with-gettext \
--with-gmp --with-imap=yes --with-iodbc --with-jpeg-dir=/usr --with-ldap=yes \
--with-mcal=/usr --with-mcrypt --with-mysql=/usr --with-ndbm \
--with-pgsql=/usr --with-png-dir=/usr --with-qtdom=/usr/lib/qt2 --with-snmp \
--with-t1lib --with-tiff-dir=/usr --with-ttf=/usr/local/typo3sh \
--with-xml --with-xpm-dir=/usr/X11R6 --with-zlib=yes --with-zlib-dir=/usr \
--with-gd=/usr/local/typo3sh --with-openssl --with-curl \
--with-imap-ssl --enable-xslt --with-pdflib=/usr/local/typo3sh \
--with-xslt-sablot=/usr/local --with-iconv --with-readline --with-mm \
--with-apxs  i586-suse-linux

Run

# make

By running make it is possible that you see too many different warnings, but it seems to be no principle errors.

One of them warning:

cc1: changing search order for system directory "/usr/local/include"
cc1: warning: as it has already been specified as a non-system directory PHP compiling

seems to be connected with errors in settings of compiller. It was nothing like this on SuSE-7.3. In any way they are only warnings

# make install

check results

It should be no problems here.

To be sure that a new PHP module is compiled check if it is in the place where other DSO for your Apache are stored. Restart Apache Server.In order to be sure that in case of problems your Apache can continue to work with PHP, make a copy of libphp4.so before you start recompiling of PHP. Then you will be able always to restart your Apache with right libphp4.so in case some problems with a newly compiled version.

As you can see from the list of necessary packages before starting PHP recompiling PHP 4.3.0 it should be compiled Sablot 097, if you don't have it by default. Even if you have recompiled it with - -prefix=/usr/local option , it can cause you some problems in case of unseccessful PHP recompilation with a following attempt to start Apache with libphp4.so from default installation. On Apache start it can give errors (at least it was so in my case). Temporary removing sablots' libraries (*.so) from / usr/local/lib somewhere else can help you to start you Apache. Then you can place them there again and continue with PHP recompilation.

Some final steps

After restarting Apache everything should work. Configuring your Typo3 system from INSTALL tool check in Basic Configuration if open_basedir option is off. If you see something like following:

safe_mode: off
sql.safe_mode: off
open_basedir set
open_basedir=/path/
 This restricts Typo3 to open and include files only in this path. Please make sure that this does not prevent Typo3 from running. Notice (UNIX): Before checking a path according to open_basedir, PHP resolves all symbolic links.

be ready to discover some other problems, for example ImageMagick will not work under Typo, although compilation ran fine.

If register_globals directive in php.ini is off, then you can heve problems with Extension Manager. Calling it with with Ext Manager link of Backend menu you can get error message like:

Fatal error: Class t3lib_tsparser_ext: Cannot inherit from undefined class t3lib_tstemplate in /opt/typo/typo3_src-3.5.0/t3lib/class.t3lib_tsstyleconfig.php on line 34

The next information is got from mailing list archiv with ready solutions to some problem, so they can be considered as some good tips.

3.1) FAQ/HOWTO items for this thread: “Does Typo3.5b5 work with PHP-4.3.0?”

Question: Does anybody know, if Typo3 works with PHP 4.3.0 or should I wait until there is a new Typo3 Version out?

Answer: Typo3 works perfectly with PHP-4.3.0, but you have to make a little change to the Typo3 source code to get it to run.

In typo3/tslib/class.tslib_fe.php you have to remove all quotation marks around LC_* at line 1335 until line 1338 because the behaviour of setlocale has changed a bit in the new PHP version, and parse errors are thrown otherwise.

Corrected lines 1335 to 1338:

Code listing:

# so we set all except LC_NUMERIC
setlocale(LC_COLLATE,$this->config["config"]["locale_all"]);
setlocale(LC_CTYPE,$this->config["config"]["locale_all"]);
setlocale(LC_MONETARY,$this->config["config"]["locale_all"]);
setlocale(LC_TIME,$this->config["config"]["locale_all"]);

3.2) The problem was stated at http://typo3.org/1422+M56b09a63975.0.html

It is really so, I had the same. Solution works fine.

Hi NG / Typo3 Users.

Additional a good new year.

Property the here following problems with new PHP4.3 and Typo3 3.5b5.

In the menu of the bakend get the following error message.

Fatal error: Cannot redeclare ts_tmplparts_rte() in

D:BigApacheApachetypo3typo3t3libclass.t3lib_parsehtml_proc.php on line 1025

This happens:

Web Functions

User Task center Setup

Tools Ext Manager

There is a recommendation of the Typo3 Gurus ; -) which PHP Version one should use ?

Thanks for your assistance.

Stefan

[TOP][NEXT] | 02-01 08:52 | by | Thomas Rodenbücher, | thomas(AT)ip69.de | | sartre

For solution have a look at:

http://www.typo3.net/viewtopic.php?t=654

The answer is here:

Zitat:

Fatal error: Cannot redeclare ts_tmplparts_rte() in c:programmeapache

groupapachehtdocstestsitetypo3t3libclass.t3lib_parsehtml_proc. php on line 1025

Das gleiche Problem hatte ich heute auch, als ich die Jahrszahl meiner

Copyrights auf 2003 abändern wollte. Das Problem lag daran, dass mein Provider ein Update auf PHP 4.3 gemacht hatte.

Die Fehlermeldung deutet exakt auf das Problem hin. Im Script class.t3lib_parsehtml_proc.php auf Zeile 1025 wird versucht die Funktion ts_tmplparts_rte erneut zu deklarieren. Das ist in PHP 4.3 nicht mehr möglich (ist auch verständlich).

Lösung: Die Funktion ts_tmplparts_rte() von der Zeile 1000 – 1024 auskommentieren.

Anschliessend muss die geänderte Datei in das t3lib Verzeichnis kopiert werden.

Unter Windows oder Linux ohne Symlinks in beide Kopien des t3lib Verzeichnisses!

Ich hoffe, es treten keine weiteren, grosssen Fehler mit PHP 4.3 auf...

One more (Bug)-Problem with a Multi-Language-Sites and IFSUB-configs.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /www/htdocs/www/t3lib/class.t3lib_page.php on line 280

that can be fixed or better to say partly fixed with changes in file t3lib/class.t3lib_page.phpthe line 267:

$query = "SELECT ".implode(",",$fieldArr)."

must be replaced with

$query = implode(",",$fieldArr);

$query=($query=="")?"*":$query;

$query = "SELECT ".$query." "."

More detail info to this error you can find at http://typo3.org/1422+ M51f9940b4b2.0.html?&tx_maillisttofaq_pi1[answered_only]=0&tx_mail listtofaq_pi1[sword]=mysql%20error%20multilanguage

Summary

At the end I want to say that all this stated above is only my experience, which I have tried to state with my imperfect English. I am very sorry for it. If some of you have some tips or corrections I will ask you kindly to point them to me.

img-1 Recompiling of packages and turning up the environment, required by Typo3 - 8