RSS 2.0
RSS 0.91
ATOM 0.3
July 13, 2007

Leaving PHP4 behind...

Category: Michael Stucki, TYPO3, Core

By: Michael Stucki

GoPHP5 logo

It's been quite some time ago that I learned programming PHP in 2000. PHP4 had just been released [1], and I was happy when I finished my first lines of code, printing out a simple "hello" to the world.

Luckily there were many hosters who announced to provide PHP4 on their servers, so I could start to code my own little templating system that generated the header and the navigation menu for my website. Until then, one had to learn far more difficult languages (allow me to say that Perl is one of them) for reaching a similar goal.

At the same time, lots of PHP4 based applications like TYPO3 were coming up and waiting to be used on the Internet. Platform independence, an Open Source license, lots of extensions and bindings, and probably also the good documentation made PHP4 soon become the number one language for web based applications.

As I wrote above, that was 7 years ago. TYPO3 is still using PHP4, which certainly has been improved hugely over time, but did not adapt any new concepts that would make a programmers life easier. (By the way, we are encountering a similar situation with TYPO3 version 5 which will also introduce some radically new concepts and draw a line behind outdated features.)

Although PHP5 (the everything-is-better successor) has been released exactly three years ago (5.0.0 came out on July 13, 2004), we still have to stay compatible with the old-school PHP4 version. The major reason for this is that ~80% of all hosters have still not switched to PHP5 by default. As long as they won't provide PHP5 out of the box, we obviously cannot use the power of PHP5.

The GoPHP5 initiative

Since we [2] finally want to move on now, and since we are not alone with this situation, we have worked together with various PHP based projects to announce the GoPHP5 initiative [3].

Our goal is that all these projects, together, will no longer support PHP4 after February 5th, 2008. In fact, a minimum version requirement of at least PHP 5.2.0 has been defined.

What does that mean?

  • TYPO3 4.2 is going to be based on PHP 5.2
  • If you are using PHP 5.2 already, nothing will change for you
  • If you are using PHP 4.x you will be provided with patch-level updates for TYPO3 4.1 for one more year (more information about future release cycles will be announced soon)
  • If you are using PHP 5.1 then you might be in luck... We are aware that enterprise Linux distributions of Novell and RedHat do not ship with PHP 5.2 yet (they both come with 5.1). Therefore, we will avoid using PHP 5.2 any specific features in TYPO3 as long as they have not switched.

Where can I find more information?

- michael


comment #1
Gravatar: Steffen Steffen July 13, 2007 05:27
The holy cow.

The main problem is that mod-php4 conflicts with mod-php5 on most distributions. That means that you (the user) are confronted with mod_cgi etc. instead of ready-to-go webspace, if you are bound to apps that depend on a

PHP 5.2.0 is out since 02-Nov-2006.

comment #2
Gravatar: Steffen Steffen July 13, 2007 05:38
[sorry, being interrupted]
... If you are bound to apps that depend on a certain PHP version, you will be driven into situations to choose between PHP4 apps and PHP5 apps. Worst case.

Btw. PHP 5.2.0 is out since 02-Nov-2006, (eight month ago, not three years).

comment #3
Gravatar: Dave Dave July 13, 2007 09:10
Congratulations for the courage to take this important step!

comment #4
Gravatar: Micha Micha July 13, 2007 10:38
Very good decision! Thanks for that!

comment #5
Gravatar: Ingo Ingo July 13, 2007 10:40
php5, at last! @Steffen, I don't see a problem as php4 code runs on php5.

comment #6
Gravatar: Michael Stucki Michael Stucki July 13, 2007 10:44
Hi Steffen,
just to let you know: I'm soon going to publish an article about installing PHP4 and PHP5 in the same environment using FCGI. Afaik this is the most powerful way of running PHP anyway...
- michael

comment #7
Gravatar: Oliver Leitner Oliver Leitner July 13, 2007 21:15
theres still a question which stays in the room...
what about the extension developers out there?

if it keeps going like with the security aspect in 3rd party extensions, im a little bit worried bout your switching to php5 plans.

comment #8
Gravatar: jeremy jeremy July 13, 2007 21:32
About time!

comment #9
Gravatar: Ferenc Hargitai Ferenc Hargitai July 20, 2007 19:10
My host switched from PHP4 to PHP 5.2.3 a few days ago.
It looked as if my typo3 4.1-based website is not affected, but Today i realized, that it throws serious "Cannot re-assign $this" messages to me on the BE, upon trying to create and save a page, or try to modify a tt_news article or just want to clear the FE cache... so my CMS is dead, basically. Is it fixed in 4.1.2 or should i wait 6 months until 4.2 is released? :((
So much about the glory of PHP5 and Typo3...

comment #10
Gravatar: Ferenc Hargitai Ferenc Hargitai July 20, 2007 20:22
OK, i quickly found the solution: this was not Typo3 nor PHP5 to blame, just a required/common Typo3 plugin called Static Info Tables.
Upgrading that to 2.0.5 solved the "Cannot re-assign $this" problem.

Actually it seems, that PHP5 become a bit more strict (demand more precise coding principle) thus more unforgiving to some coding errors.

comment #11
Gravatar: Ben Ben August 2, 2007 14:39
I appreciate that decision – thanks!

comment #12
Gravatar: dgx dgx August 3, 2007 18:00
There is a way how convert (some) PHP5 application to PHP4 - It has some limitation, but really works.

Sorry, comments are closed for this post.