dvduval — 2010-06-01T21:24:26-04:00 — #1
So while I manage PHP programmers, I would love to get some feedback about the advantages of 5, as well as the advantages of no longer being limited by needing to support 4. We have an application that is on over 100,000 websites, and we are considering completely dropping PHP 4 (finally!).
One of the main reasons we have gone this long is we had some users that would have needed to switch hosts, but now it seems that 99% of hosts now have it, and often they have both 4 and 5 available, so the worst case scenario in most cases is simply coaching them on switching PHP 5 on (ex. through htaccess).
So if I may ask a couple of key questions:
1. What new found freedoms will our programmers have on 5?
2. Any last thoughts on why we may want to continue to support 4 a little longer?
wirenine — 2010-06-06T20:38:48-04:00 — #2
It's a good idea to do this because a lot of web hosts now have dropped support for PHP 4 as it's insecure. 100% web hosting providers now offer PHP 5, some still offer PHP 4 concurrently with PHP5 but I would think all the big providers have dropped support for PHP 4.
thereddevil — 2010-06-04T07:05:01-04:00 — #3
I believe you are making a good decision to finally drop PHP 4.
We dropped support of PHP 4 after its end of life date (August 2008), even then PHP 4 had not been updated since December 2007 it had only received security fixes, which also stopped after August 2008.
With other words, you have been dragging on support PHP 4 for no reason for almost two years. Back in August 2008 basically every webhost on the planet also offered the choice of PHP 5. (I dont want to think about the amount of potential security issues your application has running under PHP 4)
I would recommend that you guys require PHP 5.2>= as it will make your life easier, if you now start coding after 5.0 or 5.1 you are putting yourself way too far back again.
Heck we are actually considering moving to PHP 5.3 at the moment on the next major version of our application.
logic_earth — 2010-06-03T15:05:14-04:00 — #4
if ( version_compare( PHP_VERSION, '5.0.0', '<' ) )
echo 'I am using PHP 4, my version: ', PHP_VERSION;
ryanhellyer — 2010-06-03T11:57:42-04:00 — #5
I would release a new version which detected PHP4, and if present, would load a warning into the upgrade area that your plugin should not be upgraded until the server is running at least PHP5.
Then a month or two later release another version which is only PHP5 compatible. That way your PHP4 users are grandfathered onto the PHP4 only version while the rest of them get a seamless upgrade to the new one.
WordPress already spits out minor errors to PHP4 users so they'll be used it anyway, and a reasonably large proportion of WordPress plugins don't support PHP4 either so they must be used to plugins not working anymore or occasionally breaking on upgrading, so a minor warning in the admin panel is unlikely to be considered out of place for them.
spacephoenix — 2010-06-03T13:45:49-04:00 — #6
The detection of the php version being used on the server is easy with phpversion() you'd just need to parse what that function replies with and if it's a 4.x or older (it wouldn't surprise me if there is a few servers somewhere on the yet using php 3.x or older), display a polite message to try and nudge them towards upgrading their server to php5.
I only started php coding when php5 was out so I don't know how easy or hard it was to get everyone to move from php 3.x to php 4.x
paul_wilkins — 2010-06-02T19:07:59-04:00 — #7
When he does code for PHP5, what habits from PHP4 do you think that he should stop using?
netnerd85 — 2010-06-02T19:05:11-04:00 — #8
The most important reason: more fun. It's just more fun to code PHP5 than PHP4. There are so many "cool" functions, it's just more enjoyable. You can actually design a real OOP application. You'll see
system — 2010-06-03T19:07:33-04:00 — #9
I no longer code to support PHP4 on the simple principle that PHP 5 is now at 5.2.3 with 5 being available for over SIX YEARS. This isn't like supporting old browsers where you are at the whim of users worldwide - this is about your host. If your host hasn't joined us in this century or doesn't give you the access to keep up yourself (hell, even WHM has EasyApache that can handle it) you're on the wrong malfing host!
When working with inheritance of objects the 'new' constructor and destructors make developing object based code so much easier - I use that a lot when working with PDO when extending it. Abstract classes make building of frameworks simpler without exposing the base method to implementation, magic methods improve working with objects greatly - and I can't see writing my code to work without them anymore. Visibility levels on methods and properties can make your code more secure, Type hinting finally lets you have an error throw if the wrong data-type is passed to a function.
In my new code I've dropped using mySQL_ functions in favor of using a PDO, and keep my PDO as a local variable in a parent function, and pass it by reference to functions that would need it - preventing the connection or the connection info from ever being 'global'. The ability to take many methods 'private' and to make it throw if my custom extensions to the pdo object are fed the wrong values results in a much more secure codebase - and even though PDO is available in the later 4.x versions - I can't do a lot of that in PHP4.
Much less the slew of "new" functions many of which I'm using and would not want to go without or have to brute-force replicate.
Hell, there have been ZERO updates since 4.4.9 back in 2008 - and those were FATAL security flaws - many flaws remain in it unpatched because official support ended in 2007!
Unless you're supporting a legacy application that for some wierd reason doesn't work in PHP5, or for some bizzare reason have some complete trash host that's still stuck a decade behind the rest of the world there is ZERO legitimate reason to restrict yourself to 4.
dvduval — 2010-06-02T13:14:35-04:00 — #10
Yes, that is exactly what we plan to do. Hopefully, after another year or so, it will become a non-issue as a greater percentage of our users will see the benefits of switching to PHP as well.
And thanks for providing some information about why you continue to support php 4 users. It seems there are some arguments for that as well, and you almost have to support both for a while still. Offering two versions is one way to get past this and code in PHP 5.
stormrider — 2010-06-02T17:42:48-04:00 — #11
Agreed - 4 has been dead way long enough now, time to upgrade! I didn't realise people were still using 4!
system — 2010-06-02T13:13:33-04:00 — #12
Sign up for a hosting package with Media Temple and you'll get a sexy control panel that allows you to switch between PHP4 and PHP5.
Thing is, PHP4 is the default. Why?
This gets me every time. I upload my stuff and it doesn't work. I fiddle around and it still doesn't work.
Then -- after having had about 30 minutes of my time wasted -- I remember that MT defaults to PHP4.
spacephoenix — 2010-06-02T13:57:07-04:00 — #13
Given that php4 has not been supported by the php development team now for over to years I personally feel that all sites have had enough time to have migrated (or at least being a fair way into migrating) themselves over to php5. Hopefully those hosts who still offer php4 will say something like "In xxx days time we will be switching all servers to php5 only, please ensure that all sites have been migrated over to php5 by then"
raju_gautam — 2010-06-02T02:53:19-04:00 — #14
Never think about 4 now and never write a single line/code that is needed extra for 4. Not only a particular reason/improvement, PHP 5 has a lot features with which you can do a task with a single function or line or so....
boen_robot — 2010-06-03T12:00:32-04:00 — #15
I can't believe no one has already mentioned [the tons of new functions in PHP 5, not to mention the many new classes, such as the majority of the [url=http://www.php.net/manual/en/refs.xml.php]XML APIs and the [url=http://www.php.net/manual/en/book.mysqli.php]MySQLi extension](http://www.php.net/manual/en/migration5.functions.php).
Without those, for me at least, coding for PHP gets a lot harder.
mittineague — 2010-06-02T12:59:08-04:00 — #16
I have written 3 plugins for WordPress. One of them has been downloaded over 43K times. I wrote the initial version release 4 years ago. In all that time I think I've had only 1 or 2 bugs reported that were PHP 4 related (one of those had old MySQL too!). I'm just about to release version 1.3.2
Because (thankfully) it seems that most users now have PHP 5, I've been thinking of slimming the weight down by stripping out all the "extra" code in it needed to maintain compatibility. Doing so would improve it some for the majority PHP 5 users. But as WordPress itself still maintains support for PHP 4, I'm hesitant to do so.
AFAIK, I have a few choices. I can keep making new releases keeping the bloat in. I can strip it out, alienating PHP 4 users. Or make a branch with a major version release.
My leanings at the time are to release a 2.0 version when - seems more like an if - WordPress drops support for PHP 4, and only maintaining the 1+ versions for any security fixes that might come to light, for a limited amount of time.
I don't know how much this relates to phpLD, but it seems you could continue to offer the old version without further enhancements. That should give some incentive for users to upgrade to PHP 5 without shutting them out completely.
ruben_k — 2010-06-02T07:49:57-04:00 — #17
PHP4 has several HUGE security holes that will NEVER be fixed (as php4 is EOL, no fixes or security updates anymore).
cerium — 2010-06-01T21:44:58-04:00 — #18
- You can stop writing accessors and mutators.
- SPL/Autoload will get rid of all those nasty includes/requires.
- If you're dealing with a lot of data Doubly Linked List is available.
logic_earth — 2010-06-02T01:54:24-04:00 — #19
For one PHP 5 is getting security patches, version 4 not so much. There also has been a considerable amount of performance and efficiency improvements. A wealth of new handy functions and extensions. The only reason to stay on version 4 is lazyness.
cerium — 2010-06-01T23:07:27-04:00 — #20
Namespaces are already available as of 5.3. The only thing that I'm aware of that will be available in 6 is full support for unicode.
next page →