Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with PHP5


Chelltune

Recommended Posts

Posted

Our host made changes to the server last night, this morning our site wasn't displaying at all. This was what they said to me:

 

'We have 2 version of PHP installed on the server, PHP4 and PHP5 - your site was originally using PHP4. As per the email you should have received this week we have been carrying out maintenance this included updating PHP4 to the latest version to keep everything secure - it seems Oscommerce will not work with the latest PHP4 but it does with PHP5'

 

And then:

'The website is now working. I've changed your site to use PHP5.

 

It looks like it's a known problem with osCommerce and the latest version of PHP 4 (4.4.5). You will need to obtain an update from the developer that fixes this issue. If you have any issues with the site or forum we will be unable to assist as it is a problem with Oscommerce and not our servers.'

 

However the site isn't working. If you click to go to the categories it just brings you to the home page again. If you click on the products it says product not found.

 

Any idea what to do?

 

The site is chelltune.co.uk

 

Thanks,

Michelle

Posted
Our host made changes to the server last night, this morning our site wasn't displaying at all. This was what they said to me:

 

'We have 2 version of PHP installed on the server, PHP4 and PHP5 - your site was originally using PHP4. As per the email you should have received this week we have been carrying out maintenance this included updating PHP4 to the latest version to keep everything secure - it seems Oscommerce will not work with the latest PHP4 but it does with PHP5'

 

And then:

'The website is now working. I've changed your site to use PHP5.

 

It looks like it's a known problem with osCommerce and the latest version of PHP 4 (4.4.5). You will need to obtain an update from the developer that fixes this issue. If you have any issues with the site or forum we will be unable to assist as it is a problem with Oscommerce and not our servers.'

 

However the site isn't working. If you click to go to the categories it just brings you to the home page again. If you click on the products it says product not found.

 

Any idea what to do?

 

The site is chelltune.co.uk

 

Thanks,

Michelle

I went and did some searching on this, and it apparently is a known issue w/ 4.4.5... Here's the PHP site's bug report on it, and the fix:

 

Description:

------------

The upgrade from PHP 4.4.4 to 4.4.5 caused a Segmentation Fault on a

client's osCommerce site. I've tracked the problem down to a

session_register function call on a undeclared variable.

 

Reproduce code:

---------------

<?php

session_start();

// Uncomment the following line to prevent the Segmentation Fault

//$myvar = 1;

session_register("myvar");

 

echo "Hello World";

?>

 

So the way to fix this is going to be that you'll need to make sure your variables are declared before you try to register them... You may be able to get away with something like this in function tep_session_register (includes/functions/session.php):

 

function tep_session_register($variable) {
global $session_started;

if ($session_started == true) {
  if (!isset($GLOBALS[$variable])) { // <-- new line
	$$variable = ''; // <-- new line
  } // <-- new line
  return session_register($variable);
} else {
  return false;
}
 }

Or something like that... The variable itself isn't passed into that function, meaning that function doesn't know it exists, so it should be ok to declare it in the local scope, register it in the session data, then pass back to the calling part of the code with that variable registered, and let that code do whatever it wants with it... Give it a shot and see if you have quirky behavior or if this fixes it... If this causes weird behavior, you may have to hunt down every instance of a call to tep_session_register, and make sure the variable is declared before trying to call that function... Good luck :)

 

Richard.

Richard Lindsey

Posted
I went and did some searching on this, and it apparently is a known issue w/ 4.4.5... Here's the PHP site's bug report on it, and the fix:

 

Description:

------------

The upgrade from PHP 4.4.4 to 4.4.5 caused a Segmentation Fault on a

client's osCommerce site. I've tracked the problem down to a

session_register function call on a undeclared variable.

 

Reproduce code:

---------------

<?php

session_start();

// Uncomment the following line to prevent the Segmentation Fault

//$myvar = 1;

session_register("myvar");

 

echo "Hello World";

?>

 

So the way to fix this is going to be that you'll need to make sure your variables are declared before you try to register them... You may be able to get away with something like this in function tep_session_register (includes/functions/session.php):

 

function tep_session_register($variable) {
global $session_started;

if ($session_started == true) {
  if (!isset($GLOBALS[$variable])) { // <-- new line
	$$variable = ''; // <-- new line
  } // <-- new line
  return session_register($variable);
} else {
  return false;
}
 }

Or something like that... The variable itself isn't passed into that function, meaning that function doesn't know it exists, so it should be ok to declare it in the local scope, register it in the session data, then pass back to the calling part of the code with that variable registered, and let that code do whatever it wants with it... Give it a shot and see if you have quirky behavior or if this fixes it... If this causes weird behavior, you may have to hunt down every instance of a call to tep_session_register, and make sure the variable is declared before trying to call that function... Good luck :)

 

Richard.

Sorry, I forgot to mention that if you're going to try this, since it shouldn't know the variable exists at this point, and since I'm not sure where those variables are stored at anyway (I'm pretty sure it's not the $GLOBALS array, that was just an example), strip out the if check and just make it like this:

 

function tep_session_register($variable) {
			global $session_started;

			if ($session_started == true) {
			  $$variable = ''; // <-- new line
			  return session_register($variable);
			} else {
			  return false;
			}
		  }

Richard.

Richard Lindsey

Posted
Has anyone tried the above? Does it work?

I haven't gotten any feedback from anyone yet about whether it works or not, but the way I see it, if your store isn't loading at all due to this problem, testing this 1 line code insert is easy enough to take a chance on, the worst that can happen is you get quirky behavior and take that 1 line back out until a fix is realized :D

 

Richard.

Richard Lindsey

Posted
nor me

Damn, oh well, it was worth a shot... Any other ideas anyone?

 

Richard.

Richard Lindsey

  • 1 month later...
Posted

Chelltune, i've seen that your website is working again.

Can you tell me how you did it?

 

I'm stuck with the same problem: if you click to go to the categories it just brings you to the home page again. If you click on the products it says product not found.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...