Page 1 of 1

Php5 migration

Posted: Wed Mar 05, 2008 5:41 am
by lettie_dude
My host provider has just decided to migrate to php5 from 4 on various servers.

An effect of this has been for several of my sites to stop working properly. Various issues are:

Session folder path could not be found and access was denied to write to the folder. (rectified by host)

$HTTP_POST_VARS stopped working causing me to go through it site and replace it with $_POST there was no notification that this would happen!

Checking variables with empty i.e. if(empty($var)) seems not to work as desired now.

Also SESSION variables are not being created or not being registered to be displayed on redirect pages.

Eveything on the sites was working correctly before migration.

Can anyone make any suggestions as to what the hosts have to implement to correct this? (whether they will is another matter!)

Also is there anything else I need to consider over and above the documentation available at php.net?

Any help much appreciated.

Cheers

Re: Php5 migration

Posted: Wed Mar 05, 2008 2:11 pm
by Ambush Commander
You must be using really old code!
Checking variables with empty i.e. if(empty($var)) seems not to work as desired now.
Objects with no properties are now NOT considered empty.
Also SESSION variables are not being created or not being registered to be displayed on redirect pages.
We'll need some code about this.

Also see: http://docs.php.net/manual/en/migration5.php

Re: Php5 migration

Posted: Wed Mar 05, 2008 4:29 pm
by Sekka
It may not seem like it now, but your host has done a good thing moving from PHP 4 to 5. PHP 5 has been out for 6 years now (maybe 5), and as such, most people should be programming in this version.

If you were programming correctly in PHP 4, you shouldn't have too many problems moving from PHP 4 to 5. Some of your code may be really old, e.g. $HTTP_POST_VARS, and as you said it is just a case of replacing them with the newer forms, e.g. $_POST.

As for your sessions, how are you using them? This is how I use sessions in PHP 5 as an example,

Code: Select all

// Start the session
session_start ();
 
// Set something in the session
$_SESSION['something'] = "Who there?";
 
// Using something from the session
echo "Bob says " . $_SESSION['something'];
 
// Removing something from the session
unset ($_SESSION['something']);

Re: Php5 migration

Posted: Tue Jun 10, 2008 5:05 am
by lettie_dude
Hi

Have found the possible reason for the session problems on the following link.

http://bugs.php.net/bug.php?id=20720&edit=2

So this problem is kind of resolved!

Will avoid using empty code in future.

Thanks to all for responses.