homepage Welcome to WebmasterWorld Guest from 54.166.173.147
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Going from PHP 4 to PHP 5
Are there any issues
adb64




msg:3764159
 7:46 pm on Oct 12, 2008 (gmt 0)

My host wants me to go from a server with PHP 4 to one running PHP 5. All the scripts on my site are running fine on PHP 4. Can I expect any issues when running the same scripts on PHP 5? What things should be modified before the conversion so the site will run smoothly after the transition?

Thanks,
Arjan

 

Rosalind




msg:3764201
 9:17 pm on Oct 12, 2008 (gmt 0)

It all depends on the scripts. There are a few issues, notably because register_globals is off by default in 5. It could cause problems, but it really depends on when your scripts were created and what versions they're for.

PHP is currently on version 6, so if you're running the latest versions of everything, as you should be for the best security, then I doubt you'll have problems. If they're custom scripts then it could be a bit of a headache.

Anyango




msg:3764210
 9:37 pm on Oct 12, 2008 (gmt 0)

Non OOP php4 scripts tend to have less problems in migration than php4 scripts with Object Oriented Style coding

So if your scripts are OOP Paradigm then do some further research before making the move.

[edited by: Anyango at 10:21 pm (utc) on Oct. 12, 2008]

dreamcatcher




msg:3764354
 7:44 am on Oct 13, 2008 (gmt 0)

Might be worth setting up a local server with PHP5 to see what happens.

dc

mrscruff




msg:3764400
 9:05 am on Oct 13, 2008 (gmt 0)

I would set up a local server running php5 and test it. If your scripts were written properly you should not have may problems.

The one to watch out for the the xml functions as these have been rewritten, for the best, so have to change the way xslt is applied to xml. This is quick, I had to do it, just put in a version check for when we upgrade so the script will work on either PHP4 or PHP5.

As always it is best to read all the documentation about the upgrade on the php website, and use something like agent ransack to check your scripts for any references to functions that may have changed or been deprecated.

tomda




msg:3764415
 10:08 am on Oct 13, 2008 (gmt 0)

Main issue I had was :

<? is no longer valid in PHP5 and should be changed with <?php (or you can change setting in your Apache also)

adb64




msg:3764441
 11:03 am on Oct 13, 2008 (gmt 0)

Thanks everyone for the input. This will give me some pointers to check before I do the transition to the other server.

dreamcatcher




msg:3764792
 7:13 pm on Oct 13, 2008 (gmt 0)

<? is no longer valid in PHP5 and should be changed with <?php (or you can change setting in your Apache also)

Thats a little incorrect tomda. Short tags work fine in PHP5. They aren`t enabled by default. Just enable them in your PHP.ini file.

dc

tomda




msg:3765879
 5:24 am on Oct 15, 2008 (gmt 0)

Thanks for your correction DreamCatcher !
I really though it was enable by default.

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