Skip navigation.

Raphael's Blog

A look into a programmer's life

Drop PHP4 support or not?

, , , , ,

The classical to do, or not to do question is here, and the InWeb CMS, x64Template and more projects are threatened because of the question.

The other day while coding the installer of the InWeb CMS and finally fixed a problem with the x64Template engine's plugins system, I wrote the next test script:

<?php

require_once("include/x64Template.php");

require_once("include/x64T_plugins/array_as_tag.php");

$tpl = new x64Template();

$tpl->set("T_VAR","test value");

$aat=&$tpl->add_plugin("array_as_tag_plugin",array());

$lang=array();
$lang['name']="spanish";
$lang['bye']="adiós";
$lang['hello']="Hola";

$aat->set("L",$lang);

$content="Hello, this is a {tag:T_VAR}! In {tag:L.name} you say hello as {tag:L.hello} and bye as {tag:L.bye} ;)";

echo $tpl->parse($content);
echo "\n unplugging plugin:\n";
$tpl->unplug($aat);
echo $tpl->parse($content);
echo "\n done\n";

?>


This script is suposed to use the new plugins system to load the Array As Tag plugin, echo some parsed test and then unplug the plugin and confirm it was unplugged by echoing the same text. Result when using PHP5:

$ php5 test.php
Hello, this is a test value! In spanish you say hello as Hola and bye as adiós :wink:
unplugging plugin:
Hello, this is a test value! In {tag:L.name} you say hello as {tag:L.hello} and bye as {tag:L.bye} :wink:
done


and php4:

php4 test.php
Hello, this is a test value! In {tag:L.name} you say hello as {tag:L.hello} and bye as {tag:L.bye} :wink:
unplugging plugin:
Hello, this is a test value! In {tag:L.name} you say hello as {tag:L.hello} and bye as {tag:L.bye} :wink:
done



Sadly but true: there seems to be a problem with PHP4's OOP support.

Even when I've tried and tried to find a workaround for this problem I haven't been able to find one.

At the moment I had to copy the current x64Template's code and adapt it to work with PHP4 (by disabling the new plugins system and making the array as tag plugin built-in) and the same for some parts of the InWeb CMS.

All this stuff is taking me a lot of time, so, I would like to hear what people think about only supporting PHP5. This decision mainly affects the next products/projects and any future project: x64Template, InWeb CMS

Shareaza 2.2.5.0 is here!Some updates

Comments

Loki1zI 6. February 2007, 02:14

yeah :smile:

php 5 is really better for OO model and for realisation of MVC framework ideas. so i don't port my projects to php 4.

atomo64 7. February 2007, 00:21

Thanks for your comment. The problem is that many hosting sites still use PHP4 and have no PHP5 support. Which means that not having PHP4 support will considerably limit the number of people who will be able to use all the software. That's why I'm asking to everybody for their opinion.

Contrid 9. February 2007, 02:55

PHP4 is great. I use it all the time.
Even so...I must admit that PHP5 has some amazing new, useful features.
Problem is...I mostly code applications for clients and very few of them actually have PHP 5 installed on their servers.
Let's give it some more time. PHP5 is around the corner.

atomo64 11. February 2007, 23:47

Problem is...I mostly code applications for clients and very few of them actually have PHP 5 installed on their servers.


That's why I wonder how many users I would be loosing if I drop PHP4 support :frown:

Let's give it some more time. PHP5 is around the corner.


PHP5 is almost three years old and PHP6 is a year or two away from now.

Stein 28. March 2007, 21:07

I'm not a coder but a sysadmin, and I think you should support php4 for some more time. Like you say, a lot of servers still run PHP4, and it will probably take long time - maybe a year or so - until most of them have PHP5 installed. Just see how long it took for servers to jump onto the apache2 wagon - and even today, a lot of sites still runs apache 1.3

At least wait until Debian Etch is released (very soon now) - it includes php5 so it may be worth waiting for people to upgrade their deb servers.

Just my 2 cent :smile:

atomo64 23. April 2007, 18:42

Thanks everybody for all the comments, but as I posted here, php4 support has been dropped. And btw, etch is already out there :wink:

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies