homepage Welcome to WebmasterWorld Guest from 54.237.99.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP4 to PHP5 migration
mikesmith76

5+ Year Member



 
Msg#: 3533971 posted 7:03 pm on Dec 23, 2007 (gmt 0)

Hi all,

This is a split off from another thread as we were starting to get distracted from the original posters question.

Basically now that PHP4 is approaching the end of its official lifespan, should we still be running versions of php4? I realise there are many large applications out there that may or may not work out of the box with php5, but shouldn't people now take the time to start the update process?

The question came about as a suggestion was made in the thread to find a dedicated server still running php4 to run an application on. My response to this is that it is a bad idea, as you would be running a version of php which in 6 months will not have any security updates produced, new functionality added etc. I know an experienced c developer could try and keep the php source secure, however seems a bit hackish.

Also from my experience not a great deal has changed between php4 and php5, and i've had to migrate some pretty large apps over the past 6 months. I'd be interested in hearing from others about how smoothly (or not) migration has been for them.

Awaiting your responses
Mike

 

eelixduppy

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3533971 posted 8:05 pm on Dec 23, 2007 (gmt 0)

>> shouldn't people now take the time to start the update process?

Upgrading from 4 to 5 is something to really consider doing whenever possible without causing too much trouble for yourself. If the upgrade is going to cause more problems than it is currently running php 4 then maybe an upgrade would be better to get in the future. One way or another upgrading php will probably be inevitable for most.

>> Also from my experience not a great deal has changed between php4 and php5

Yes and no. If you plan on doing any object-oriented projects or working with XML, php 5 offers much more than 4 does. This might be an incentive in itself to upgrade to php 5.

You might also want to take a look at the documentation for migrating from 4 to 5. There is some nice information in there regarding the two: migrating from 4 to 5 [us2.php.net].

mikesmith76

5+ Year Member



 
Msg#: 3533971 posted 9:25 pm on Dec 23, 2007 (gmt 0)

Upgrading from 4 to 5 is something to really consider doing whenever possible without causing too much trouble for yourself.

I think this line of thinking is one of the reasons php4/5 have co-existed for so long. So long as php4 was still in active development there was no real incentive for a developer to migrate old code. If people haven't looked at PHP5 I think now is definitely the time to consider it, before it's too late.

Yes and no. If you plan on doing any object-oriented projects or working with XML, php 5 offers much more than 4 does. This might be an incentive in itself to upgrade to php 5.

True. What i was trying to get across in the original message was that not a lot has been broken between php versions. PHP4 code in most cases should just work on PHP5. Sure php5 adds a lot of improvements in terms of OOP, and as you mentionned with XML also.

Great link you've posted, i've read over it many times in the past when migrating applications.

igorberger

5+ Year Member



 
Msg#: 3533971 posted 11:48 pm on Dec 23, 2007 (gmt 0)

Thank you for spliting the thread and bringing the migration issue to the table.

I do agree making all the scripts PHP5 compatible is the best solution, but will have to rewrite and rehack applications to make customs sessions work properly, just because of object oriented stracture has been redefined.

Thus destructors can use sessions but session handler can't use objects. In prior versions, they were called in the opposite order.

When I sarted scripting PHP4 3 years ago the PHP project did not stress that one should do PHP5 which I find a bit iresposible for the consortium.

The custom Zend sessions I installed where written in PHP4.

Granted at the end of the day resposibility is my to follow the appropriate development path.

I tried to look for a rewritten Zend custom sessions for PHP5 but could not find one. Asked Zend for support got none.

I looked at object oriented classes, even coded an original routine for php.net, yes I can figure out how to rewrite the Zend custom sessions to make it PHP5 workable.

But will require time, as well as will have to rehack phpBB as well.

I am a coder by heart, and been coding on and off since 1985 in FORTRAN.

But because of the new age economy I am forced to wear many hats at the same time.

I have to be an SEO, Webmaster, developer, business consultant to my company, and many other things, which are not pertinent to this discussion.

In the business world it is all about prioratizing, it is reality not pure coding practisses in a vacuum.

In Cuba they still drive 1950s chevrolets and cadilacs.
If you need to make things work you do, that is why we call it "Hacking!"

I am going to try to get the coding for my projects outsourced to have it done properly, but will need to find budgets for each project.

So, will have one foot in PHP4 and one in PHP5 as things evolve.

I think I am defining yet another job title here for myself, project planer..:)

Okay, now back to chicken and the egg story.

Under Cpanel are all the GNU software scripts PHP5 compatible? It will be a nightmare for hosting companies, if after the migration customer are not able to run WorPress, phpBB, Agora, Drupal, etc instalations!

Thank you,
Igor

mikesmith76

5+ Year Member



 
Msg#: 3533971 posted 9:55 am on Dec 24, 2007 (gmt 0)

Thus destructors can use sessions but session handler can't use objects. In prior versions, they were called in the opposite order.

I'm sorry I've read over this several times and i'm not sure what you are getting at? I've got a custom session wrapper wrote and working in php5 that uses objects without a problem. Also I wasn't aware that php4 had destructor support.


I tried to look for a rewritten Zend custom sessions for PHP5 but could not find one. Asked Zend for support got none.

I looked at object oriented classes, even coded an original routine for php.net, yes I can figure out how to rewrite the Zend custom sessions to make it PHP5 workable.

But will require time, as well as will have to rehack phpBB as well.

I think this is probably the big problem for everyone. So much code exists for PHP4 which may need altering / fixing to work cleanly under PHP5. And in your case your custom code sounds like it is implemented in multiple places.

I don't know if its any use to you but the Zend Framework (http://framework.zend.com) includes some custom session code that may be worth looking at. It may save you some time with your particular circumstances?

Under Cpanel are all the GNU software scripts PHP5 compatible? It will be a nightmare for hosting companies, if after the migration customer are not able to run WorPress, phpBB, Agora, Drupal, etc instalations!

Yes I can imagine this being a problem. However if all the applications you mentioned are under active development they should all be working to produce updated versions. So should the makers of Cpanel.

I think the PHP4 cut off has been made more difficult as hosts didn't seem to push to get the latest version of PHP out. While PHP4 was / is still in widespread use there was no incentive for PHP apps to release new versions, no incentive for individual developers to upgrade their code. Although as you say the PHP developers could've done more to push PHP5.

mikesmith76

5+ Year Member



 
Msg#: 3533971 posted 9:57 am on Dec 24, 2007 (gmt 0)

Sorry... You mentioned in the previous thread that you considered yourself to be a core hacker? Have you made many modifications to the PHP source? I'd be interested in hearing more about this if you are willing?

Thanks,
Mike

igorberger

5+ Year Member



 
Msg#: 3533971 posted 10:05 am on Dec 24, 2007 (gmt 0)

mike, we are core hacking right now!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved