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
Php5 migration
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Re: Php5 migration
You must be using really old code!
Also see: http://docs.php.net/manual/en/migration5.php
Objects with no properties are now NOT considered empty.Checking variables with empty i.e. if(empty($var)) seems not to work as desired now.
We'll need some code about this.Also SESSION variables are not being created or not being registered to be displayed on redirect pages.
Also see: http://docs.php.net/manual/en/migration5.php
- Sekka
- Forum Commoner
- Posts: 91
- Joined: Mon Feb 18, 2008 10:25 am
- Location: Huddersfield, West Yorkshire, UK
Re: Php5 migration
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,
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']);-
lettie_dude
- Forum Commoner
- Posts: 65
- Joined: Thu Dec 07, 2006 10:10 am
Re: Php5 migration
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.
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.