Welcome to WebmasterWorld Guest from 54.167.83.224

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Going from PHP 4 to PHP 5

Are there any issues

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

Full Member

10+ Year Member

joined:Feb 4, 2004
posts: 305
votes: 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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 16, 2003
posts:992
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 24, 2005
posts:697
votes: 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]

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

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 0


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

dc

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

Junior Member

5+ Year Member

joined:Feb 22, 2008
posts:43
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 7, 2004
posts:929
votes: 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)

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

Full Member

10+ Year Member

joined:Feb 4, 2004
posts:305
votes: 0


Thanks everyone for the input. This will give me some pointers to check before I do the transition to the other server.
7:13 pm on Oct 13, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 7, 2004
posts:929
votes: 0


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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members