Forums / General Questions / php 5.2.0 update problem

php 5.2.0 update problem

Locked

Started by ca18 on 3 Nov 2006, 1:12 PM · Views: 73,474

Results 21 to 40 of 46
This thread is locked. New replies are disabled.
4 Nov 2006, 4:05 PM
#21
linksys avatar

linksys

New Zenner

Join Date:
Nov 2006
Posts:
30
Plugin Contributions:
0

php 5.2.0 update problem

sh33pz:

:sleepy: My clients on my server also have the same issue... There seems to be a issue with ZenCart and php-5.2. In order to correct the issue I had to roll back php to 5.1.6.

Any Idea when a fix/patch will be released?

As a workaround: you don't have to roll back to php 5.1.6. Just change your session to be "file based" from "database based" in the ZenCart config file: includes/configure.php and admin/includes/configure.php

This way you can still run ZenCart while taking advantage of the PHP 5.2.0 security and bug fixes. But I would still prefer to switch back to database-based session for security sometime later when we find a solution.

4 Nov 2006, 4:14 PM
#22
sh33pz avatar

sh33pz

New Zenner

Join Date:
Nov 2006
Posts:
3
Plugin Contributions:
0

Re: php 5.2.0 update problem

Aww sweet, Thanks for the info.

Will try that out later tonite

4 Nov 2006, 7:52 PM
#23
ca18 avatar

ca18

New Zenner

Join Date:
Jun 2006
Posts:
20
Plugin Contributions:
0

Re: php 5.2.0 update problem

Meanwhile others find the same problem:

http://community.mybboard.net/showthread.php?tid=13506&page=1

And it's been reported now:

http://bugs.php.net/bug.php?id=39381

So it's not ZC which is giving php a bad rep like this twit claims

http://caseysoftware.com/zend-conference-2006-day-2

but php.net themselves which first quarrel about 5.2.0 for several weeks and then YET again don't get it right so half the world is laughing about more bugged or better f***ed-up php-releases :shocking: Like last time 5.1.6 when they "forgot" something for the 64bit uP, unbelievable. This is really gonna start to pi55 me off now ... :cry:

4 Nov 2006, 8:41 PM
#25
sh33pz avatar

sh33pz

New Zenner

Join Date:
Nov 2006
Posts:
3
Plugin Contributions:
0

Re: php 5.2.0 update problem

Thanks for the info bud :) So it's off to php.net to bug them for a fix Thanks to everyone for their help! My clients will be happy to know.. its php itself to blame not Zen Cart !!!

As fir the Zen Cart Coders... Keep up the good work! I kinda figured after.. it must be php itself.. I just couldn't see ya guys.. over look this!

6 Nov 2006, 9:31 AM
#26
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: php 5.2.0 update problem

It appears as though PHP has assigned the bug to someone for fixing.

However, in the meantime, you have two options:
a. use file-based caching instead of database-based (not really a good solution, but works around the problem, but is less secure and much less flexible for most hosting environments. 'db' is really the better choice except in the case of this PHP bug):
configure.php file:
define('STORE_SESSIONS', '');

OR:

A Suggested Bandage:
b. edit /includes/functions/sessions.php
and** /admin/includes/functions/sessions.php**, if it exists on your site:

    function _sess_write($key, $val) {
      global $db;
      global $SESS_LIFE;

change to:

    function _sess_write($key, $val) {
      // The following is only to work around a PHP 5.2.0 bug:
      global $db;
      if (!is_object($db)) {
        //PHP 5.2.0 bug workaround ... 
        $db = new queryFactory();
        $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
      }

      global $SESS_LIFE;

Option (b) may or may not be "complete", and has only had preliminary testing. The best fix will be to have PHP fix their bug, of course.

NOTE: If this fix "works" for you, then you need to upgrade your version of Zen Cart ... sooner than later. The latest version of Zen Cart contains a number of fixes related to PHP5 and MySQL5. You should plan your upgrade ... soon.

Addendum: There are some other technical approaches which could be used to address the session_write_close() and register_shutdown_function() changes introduced in this new PHP version. These may be explored in the future. For now, the above approaches are the simplest to implement for those needing to make a quick-fix to their code.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Nov 2006, 2:37 PM
#27
xplorer avatar

xplorer

New Zenner

Join Date:
Jul 2006
Posts:
14
Plugin Contributions:
0

Re: php 5.2.0 update problem

Thanks

it is working now.

6 Nov 2006, 8:48 PM
#28
ca18 avatar

ca18

New Zenner

Join Date:
Jun 2006
Posts:
20
Plugin Contributions:
0

Re: php 5.2.0 update problem

Thanks for the workaround DrByte! :clap: :cheers:

8 Nov 2006, 6:58 PM
#29
linksys avatar

linksys

New Zenner

Join Date:
Nov 2006
Posts:
30
Plugin Contributions:
0

Re: php 5.2.0 update problem

The related PHP bug (http://bugs.php.net/bug.php?id=39381) was updated by the PHP developer asking for sample code to reproduce. Anyone can provide one? DrByte? :)

10 Nov 2006, 1:38 PM
#30
kmzeron avatar

kmzeron

New Zenner

Join Date:
Nov 2006
Location:
Romania
Posts:
12
Plugin Contributions:
0

Re: php 5.2.0 update problem

Hello ! This is my first post on zen-cart forum ! I wanna thank you very much to DrByte ! Good job. Best regards!

Software Shop - Computer Software <- My Zen-Cart
Find your love - Online Dating Site
Submit Free - Web Directory

10 Nov 2006, 8:56 PM
#31
ca18 avatar

ca18

New Zenner

Join Date:
Jun 2006
Posts:
20
Plugin Contributions:
0

Re: php 5.2.0 update problem

php.net have marked their bug or better fcukup as bogus now so they won't fix it :shocking: :huh:

11 Dec 2006, 6:20 PM
#32
bugfreek1 avatar

bugfreek1

New Zenner

Join Date:
May 2004
Posts:
2
Plugin Contributions:
0

Re: php 5.2.0 update problem

All--

Running into an interesting challenge with our store. We did an upgrade to our server for XML purposes, ran into the session challenge described in this thread. Using Dr. Byte's fix seemed to work...for a few days. Then one of our admin users (there are 5, using the main admin password) described getting kicked out of the Admin area....but only on some computers. We performed the usual cache and session clearing on her computer, plus installed Firefox since we're convinced that IE is the root of all internet evil. The problem seemed to right itself...at least for a few days.

We've gotten word that another user is having this problem, only clearing cache and switching to Firefox seems to do nothing. We've logged into her computer using a different user profile (running win xp) and the admin area works fine. However, no matter what we do, we can't get reports to work for her. The usual answer would be to fix the roaming profile she uses on the Win2k3 server, but roaming profiles are off....and the problem persists across any computer she jumps on in the office.

Anybody have any ideas at all? I'm convinced this is a profile issue, but we can't prove it.

Thanks,
Ben Peterson
Interactive Media Developer
Space Foundation

21 Dec 2006, 4:47 AM
#33
rhys100 avatar

rhys100

New Zenner

Join Date:
Oct 2006
Posts:
48
Plugin Contributions:
0

Re: php 5.2.0 update problem

i tired this fix but got this error.

Fatal error: Cannot redeclare _sess_write() (previously declared in /home/bdmaxcl/public_html/store/includes/functions/sessions.php:34) in /home/bdmaxcl/public_html/store/includes/functions/sessions.php on line 53

please post fix asap.

21 Dec 2006, 4:52 AM
#34
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: php 5.2.0 update problem

Both of the sessions.php function files need to be updated ...

http://www.zen-cart.com/forum/showpost.php?p=287587&postcount=26

/includes/functions/sessions.php

/admin/includes/functions/sessions.php

The files are pretty similar ... and the fix is more or less the same ...


NOTE: If this fix "works" for you, then you need to upgrade your version of Zen Cart ... sooner than later. The latest version of Zen Cart contains a number of fixes related to PHP5 and MySQL5. You should plan your upgrade ... soon.

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Feb 2007, 5:49 AM
#35
freya avatar

freya

Zen Follower

Join Date:
Mar 2006
Posts:
122
Plugin Contributions:
0

Re: php 5.2.0 update problem

Okay. I have done the session fix. While the error message is gone, when I "sign in", I don't get any further than the sign in page. That's right. It's like the sign in page is refreshing.

Marci

Marci Baun, Publisher
http://www.wildchildpublishing.com/ -- Break free...read wild!
http://www.freyasbower.com/ -- Weaving passion into words...

15 Feb 2007, 12:51 PM
#36
muntada avatar

muntada

New Zenner

Join Date:
Feb 2007
Posts:
4
Plugin Contributions:
0

Re: php 5.2.0 update problem

Make sure both look EXACTLY like this:

    function _sess_write($key, $val) {
      // The following is only to work around a PHP 5.2.0 bug:
      global $db;
      if (!is_object($db)) {
        //PHP 5.2.0 bug workaround ...
        $db = new queryFactory();
        $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
      }
      global $SESS_LIFE;


NOTE: If this fix "works" for you, then you need to upgrade your version of Zen Cart ... sooner than later. The latest version of Zen Cart contains a number of fixes related to PHP5 and MySQL5. You should plan your upgrade ... soon.

15 Feb 2007, 2:20 PM
#37
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: php 5.2.0 update problem

NOTE: this php 5.2.0 bug does have a temporary fix built into Zen Cart v1.3.7 ...

For this and other issues for security, bugfixes and additional features it is strongly recommended that you upgrade to Zen Cart v1.3.7 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 Feb 2007, 11:41 AM
#38
jenna avatar

jenna

New Zenner

Join Date:
Feb 2007
Posts:
2
Plugin Contributions:
0

Re: php 5.2.0 update problem

Thanks for the workaround DrByte! Works like a charm! :happy:

5 Mar 2007, 5:14 AM
#39
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: php 5.2.0 update problem

NOTE: this is built into the current version of Zen Cart ... v1.3.7 ... might want to upgrade for this and many other bugfixes, security issues and features ...

Plus, if using PayPal ... keep an eye on the PayPal Patch thread:
http://www.zen-cart.com/forum/showthread.php?t=56216

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Mar 2007, 6:15 AM
#40
lemuria avatar

lemuria

New Zenner

Join Date:
Aug 2005
Posts:
59
Plugin Contributions:
0

Re: php 5.2.0 update problem

On this and other threads, I'm seeing some people recommend this:
define('STORE_SESSIONS', '');

and some this:
define('STORE_SESSIONS', 'file');

Is there a difference between these two options? Is one of them better? They both seem to work.