Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP 5.4 - what impact will it have on OsC v.2.x?


rimote

Recommended Posts

  • 2 months later...
  • Replies 63
  • Created
  • Last Reply

I've been running 2.x for over 5 years with 0 issues. Of course, I've had to update a few functions to be compliant with new versions of php. Unlike Gergely's customers, customers at my shop could care less if I am running the 'latest, greatest' version of Oscommerce, just as long as the store is secure and fast.

 

The code is sloppy by today's standards, but it works and does what it needs to do. I've added thousands of hours worth of code & features to my store, why should I re-code of that for osc 3 or even 2.4 (unless we are talking about security patches, of course)? I don't need anything with 2.4/3.0 that I don't already have.

 

I would imagine (judging by this forum alone) that most shop owners aren't programmers or have next to nil experience with php.) -why should they be forced to upgrade several versions that simple patches on 2.x could fix?

 

HPDL's post on the 1st page doesn't seem too complex to create a patch for. The $_POST and $_GET change-overs were added via patch a while back if my memory serves correct.

Link to comment
Share on other sites

  • 9 months later...

Hi

 

Earlier in this discussion I saw that

2.3.1 needs mainly 2 small code changes to work on PHP5.4 , so its not that much of a major issue.

 

I would like to ask if ther is any official incstruction how to make 2.3.X work on PHP 5.4.

I am currently using 2.3.2 on PHP 5.3 and need to move to server with PHP 5.4.

 

As expected I had some problems with global variables on PHP 5.4.

 

Thanks in advance for any tips how to make 2.3.2 work with PHP 5.4

Link to comment
Share on other sites

Thanks

 

It looks that I had to copy only sessions.php form 2.3.3 and all problems with global variables that I found on PHP 5.4 disapeared.

Do you know if there are any other files that are critical for PHP 5.4?

I have few private modifications so I would not want to overwrite all files.

Link to comment
Share on other sites

Modifying admin and shop side sessions.php is all that is needed for it to run on 5.4 , but you should really do the full upgrade. There are step by step manual upgrade instructions in the 2.3.3 download.

Link to comment
Share on other sites

  • 8 months later...

The new Goddady servers with C-panel are running PHP 5.4 and I have OSC version MS2.2 on PHP 5.3 with a ton of add-ons. Trying to find something in terms of instructions for the PHP 5.4 bump along with possible implications of what features and add-ons will and will not work with the upgrade. If anyone knows of a fix or a good source of info, please reply. Thanks.

 

Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&geo=US&q=oscommerce

Link to comment
Share on other sites

  • 3 weeks later...

@@Demitry I am in the same exact boat as you, as I am sure thousands of other users are as well.

I am pretty sure that every single mod we have can be modified to work with PHP 5.4 on our MS2.2 (RC2a), but the question is - what are the things that need to be done?

 

Will following just the points HPDL posted earlier be enough?

 

* Replace HTTP_*_VARS with super globals (eg, HTTP_GET_VARS to _GET)

* Replace session_register, session_unregister, and session_is_registered with $_SESSION['key'] = $value, isset($_SESSION['key']), and unset($_SESSION['key'])

* Replace global session variables with $_SESSION['key'] (and remove "global $session_var" from functions)

* magic_quotes deprecated since v5.3 but compatibility.php works around it as if it was on; either this is kept or we look at changing this to work as if it was off.

 

 

P.S. The MS2.2 (RC2a) shop is currently running (perfectly, after modifying it for 5.3) on PHP 5.3.28, but we must upgrade to 5.4 fairly soon, so we'd rather have it ready sooner than later.

Link to comment
Share on other sites

Try to get ahead of the ball and work on a new store on the latest version 2.3.3.4 - which is what I have just gone through - most of the add-ons I needed either worked or worked with a few tweeks, the only one I have binned as being too big a job to look at was OSC Affilliate .. but I can live without that one.

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

@dr_lucas, it should not be necessary to replace $HTTP_*_VARS by $_* -- the compatibility layer should take care of that for you. Eventually, osC should be cleaned up to use $_* forms natively, but that should not be needed to run under 5.4. I think HPDL was just listing that as a work item to bring osC into the 21st century.

 

Regarding the sessions stuff, PHP 5.3 and up have made a lot of changes to sessions handling. I don't know if the changes you listed will do the job -- it would be nice to have an official patch, or at least, instructions on what needs changing. Ditto for magic quotes.

Link to comment
Share on other sites

@@Mort-lemur

not a good option as the store is super heavily modified with hundreds of tweaks, enhancements and contributions, so I am pretty sure just fixing compatibility from 5.3 to 5.4 will be quicker and far easier.

 

@@MrPhil

100% agree, it would be really nice if someone can post even just general instructions on the required changes to upgrade MS2.2 RC2a for PHP 5.4 compatibility and we will take it from there.

Link to comment
Share on other sites

If you follow the step by step upgrade instruction from your version and up to the latest version, your "core" shop will be compatible with PHP5.4.

 

Additionally you will probably also have to update or modify some of your add-ons/modifications to make those compatible with PHP5.4 too.

Link to comment
Share on other sites

@@toyicebear Thanks, but instead of going through that tedious route, I am looking more for a general guideline like hpdl's quotation I posted earlier:

 

* Replace HTTP_*_VARS with super globals (eg, HTTP_GET_VARS to _GET)

* Replace session_register, session_unregister, and session_is_registered with $_SESSION['key'] = $value, isset($_SESSION['key']), and unset($_SESSION['key'])

* Replace global session variables with $_SESSION['key'] (and remove "global $session_var" from functions)

* magic_quotes deprecated since v5.3 but compatibility.php works around it as if it was on; either this is kept or we look at changing this to work as if it was off.

Link to comment
Share on other sites

ok, so I went ahead and copied the 2 sesssions.php function files from 2.3.3.4 package, replaced my old ones and everything now seems to be working just fine on PHP 5.4.24

I just needed to fix a few ImageJPEG calls (they had '' instead of null), for example ImageJPEG($dst, '', 90); changed to ImageJPEG($dst, null, 90);

Since HTTP_*_VARS, and magic_quotes are already dealt with by the compatibility layer I assume there is nothing else to be done. Am I right or did I miss something?

 

P.S. I am on MS2.2 RC2a

Link to comment
Share on other sites

I just bumped into an issue with htmlspecialchars on PHP 5.4, which has been reported and a fix provided in the following thread: http://www.oscommerce.com/forums/topic/391784-bug-with-php-546/

However the osc 2.3.3.4 still does not seem to have this implemented (didn't check github).

hpdl, can you please add this fix to the core?

Link to comment
Share on other sites

Hi, my host didn't warn me that they were upgrading to 5.4 and even if they did I don't think I would of been aware of the problems I would have. Running 2.2rca and my site has pretty much stopped working. www.discontoys.com

 

I can't see the categories, products or reviews and in my admin I can't see these or my past orders. There seems to be so many contricting advice so my mind is all over the place. Can someone tell me if I can get my site and admin back up and running or not? Just need to get in running so over the next week or two I can start to migrate to 2.3.

 

Strangly enough I can get the categories to appear if I dont use www. so just http://discontoys.com

Link to comment
Share on other sites

My 2.2 RC2a runs quite superbly on PHP 5.4, and not many modifications needed if you come from PHP 5.3 and had no problems. So unless that's the only thing they changed, you should be up and running quite quickly. Just follow my earlier comments.

 

-UPDATE-

By the way, I just tested your link and it works just fine for me, everything loads, either with or without www...

Link to comment
Share on other sites

Michaela, many thanks for the reply. Im not sure why the front end has started working...maybe the webhost has noticed an issue and corrected it. I still have an issue with the admin not showing categories, products, orders etc..did you have issues with this at all? Thanks for your time.

Link to comment
Share on other sites

I don't recall having such issues in my admin, but I did upgrade my osC to work on PHP 5.4 prior to switching (according to hpdl guidelines I listed) so it might be the reason why I never had this issue you are having.

Strangely tho, if you front end works now after your webhost changed something, I'd assume the admin will go back to normal as well...

I think I will only be able to analyze the issues you are having by having a look at both sides of your site and the files, error logs etc...

Link to comment
Share on other sites

If your site "just started working again", you might use the program

<?php phpinfo(); ?>

to verify what PHP version you're actually running on. Perhaps your host rolled you back to an earlier version? Note that it's likely to be only a temporary reprieve, and you need to get moving on fixing your store. It's also possible that your host discovered and fixed a PHP configuration problem.

 

Certainly, an unmodified osC 2.2* store is not going to run on PHP 5.3 or higher. Do you know what PHP version you were running on before? Do you know if your 2.2RC2a store was updated to work with PHP 5.3? If it was, it should only be fairly minor fixes to run on PHP 5.4. The big step was getting to PHP 5.3.

 

If the prospect of patching your 2.2 store to run on PHP 5.4 is too daunting, you could take a look at jumping directly to osC 2.3.3.4, which I understand is PHP 5.4 compatible. It might actually be faster and easier to install it and migrate your data over than to try to patch the old store. If your old store is heavily modified (add-ons and custom code), or is a third-party template, it could be difficult either way to get to a 2.3.3.4 installation with the look and feel of the old store. If it isn't all that modified, I would suggest as a first step to make a test installation of 2.3.3.4 off to the side in a /dev or /test directory, and try migrating a copy of your database and product images over (there's an add-on for the database changes). You may find that sufficient to at least be up and running while you tweak the theme and find some add-ons you want.

Link to comment
Share on other sites

FWIW Another side-effect which can be a damn nuisance is that php5.4 by default reports Strict errors.

Of course this can be disabled in a php.ini setting by doing the following:

 

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

 

however if you run 3rd party encoded modules (eg powerseos from magneticone) and they have error_reporting set to include strict errors at runtime in scripts and they haven't updated their scripts for php 5.4, you'll end up quickly building massive error_logs. If you happen to be on a quota-enabled account (eg cPanel) you could experience the negative consequences of running out of disk space.

 

Sure you could make the resultant error_log file non-writable but that's not really solving the issue eh.

 

Simon

Link to comment
Share on other sites

Which is why I always decrypt my encoded zend or ion scripts...but, that's for another topic... :P

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...