Forums / General Questions / Warning: session_start(): Trying to destroy uninitialized session

Warning: session_start(): Trying to destroy uninitialized session

Started by batteryman on 20 Apr 2016, 4:44 PM · Views: 12,032

Results 1 to 14 of 14
20 Apr 2016, 4:44 PM
#1
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Warning: session_start(): Trying to destroy uninitialized session

My site just started to have this issue yesterday morning after processing several orders. No code or database changes have been made in several months.

Warning: session_start(): Trying to destroy uninitialized session in /includes/functions/sessions.php on line 114 Warning: session_start(): Failed to decode session object. Session has been destroyed in /includes/functions/sessions.php on line 114

**What would be causing this?
**
I have checked the database sessions table and ensured it is optimized and not having any issues. Checked the session write path and made sure the folder exist and is writeable.

User of zencart

20 Apr 2016, 5:18 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Warning: session_start(): Trying to destroy uninitialized session

What are the particulars of your server??

admin > tools > server/version info

Zen-Venom Get Bitten

20 Apr 2016, 6:10 PM
#3
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

What in particular are you looking for. Its a security hazard to post my server info publicly. Perhaps I can PM you with it.

User of zencart

20 Apr 2016, 6:17 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Warning: session_start(): Trying to destroy uninitialized session

You can safely post any of the following information:

Server Host: servername.hostingcompany.com (192.168.10.1)
Server OS: Darwin 15.4.0
Server Date: 04/20/2016 14:16:08
Server Up Time: 14:16 up 1 day, 12:55, 2 users, load averages: 2.20 1.80 1.68
HTTP Server: Apache/2.2.29 (Unix) PHP/5.6.15 mod_ssl/2.2.29 OpenSSL/0.9.8zc
PHP Version: 5.6.15 (Zend: 2.6.0)
PHP File Uploads: On
Upload Max Size: 256M
PHP Memory Limit: 128M
POST Max Size: 128M
Database: MySQL 5.5.27
Database Host: localhost (127.0.0.1)
Database Date: 04/20/2016 14:16:08
Database Data Size: 435 kB
Database Index Size: 571 kB
MySQL Slow Query Log Status: On
MySQL Slow Query Log File:/var/log/mysql/data/mysql-slow.log
MySQL Mode: (None set)


Zen Cart 1.5.5

Database Patch Level: 1.5.5

v1.5.5 [2016-03-27 17:29:07] (New Installation-v155)
v1.5.5 [2016-03-27 17:29:07] (New Installation-v155)

PHP Version 5.6.15


.
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.

20 Apr 2016, 6:36 PM
#5
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

Server Host: xxxx Database Host: database (xxxx)
Server OS: Linux 3.2.0-99-virtual Database: MySQL 5.5.44-0ubuntu0.12.04.1
Server Date: 04/20/2016 18:35:36 Database Date: 04/20/2016 11:35:36
Server Up Time: 18:35:36 up 1:30, 0 users, load average: 0.57, 1.07, 1.56 HTTP Server: Apache
PHP Version: 5.3.10-1ubuntu3.21 (Zend: 2.3.0) PHP Memory Limit: 1024M PHP Safe Mode: Off
PHP File Uploads: On Max Size: 2M POST Max Size: 8M
Database Data Size: 879,303 kB Database Index Size: 36,741 kB

[TABLE="width: 700"]

Zen Cart 1.3.9h

Database Patch Level: 1.3.9a

v1.3.9a [2010-05-03 14:18:48] (Version Update 1.3.8->1.3.9a)
v1.3.8 [2009-12-28 15:28:23] (Version Update 1.3.7->1.3.8)
v1.3.7 [2007-04-15 23:06:24] (Version Update 1.3.6->1.3.7)
v1.3.6 [2007-04-15 23:06:24] (Version Update 1.3.5->1.3.6)
v1.3.5 [2007-04-15 23:06:24] (Version Update 1.3.0.2->1.3.5)
v1.3.0.2 [2007-04-15 23:06:23] (Version Update 1.3.0.1->1.3.0.2)
v1.3.0.1 [2007-04-15 23:06:23] (Version Update 1.3.0->1.3.0.1)
v1.3.0 [2007-04-15 23:06:23] (Version Update 1.2.7->1.3.0)
v1.2.7 [2007-04-15 23:06:23] (Version Update 1.2.6->1.2.7)
v1.2.6 [2007-04-15 23:06:23] (Version Update 1.2.5->1.2.6)
v1.2.5 [2005-08-01 03:48:05] (Version Update 1.2.4->1.2.5)
v1.2.4 [2005-08-01 03:47:52] (Version Update 1.2.3->1.2.4)
v1.2.3 [2004-12-19 18:55:19] (Version Update 1.2.2->1.2.3)
v1.2.1 [2004-10-07 03:24:42]

PHP Version 5.3.10-1ubuntu3.21

[/TD]
[/TR]
[/TABLE]

User of zencart

20 Apr 2016, 7:51 PM
#6
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

Any Help is Appreciated, Orders have stop coming in entirely since yesterday.

User of zencart

20 Apr 2016, 8:06 PM
#7
drbyte avatar

drbyte

Sensei

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

Re: Warning: session_start(): Trying to destroy uninitialized session

Yours is the first time i've ever seen that message happen on a Zen Cart site.

And it's not caused by Zen Cart itself. It seems to be something your server is doing at the PHP level, before Zen Cart can do anything.

You said you're not aware of any "changes". But, since the symptoms ARE a change, that means something DID change. Now you need to find out "what".

I'm going to recommend that you do a complete audit of all the files on your server, comparing them against a clean backup ...... you do make backups, don't you? If you never made a backup of the files on your server, then use the original Zen Cart files as the comparison point.
Full process explained here: http://www.zen-cart.com/wiki/index.php/Recovering_From_Hacks ... go through that until you're certain that you've confirmed that these symptoms are not caused by something malicious.

.
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.

20 Apr 2016, 8:46 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Warning: session_start(): Trying to destroy uninitialized session

DrByte:

If you never made a backup of the files on your server, then use the original Zen Cart files as the comparison point.
Full process explained here: http://www.zen-cart.com/wiki/index.php/Recovering_From_Hacks ... go through that until you're certain that you've confirmed that these symptoms are not caused by something malicious.

Be prepared to see significant differences in the code if this 1.3.9a site was previously functioning satisfactorily on PHP 5.5... obviously would be looking for odd unrelated/unrecognized code.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

20 Apr 2016, 8:53 PM
#9
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

My site is on an Cloud Server where the coded is protected and the images are utilized and destroyed on an hourly basis. Hacking probably isnt the issue. What else could be the issue.

I will still look for the possibilities of file tampering.

User of zencart

20 Apr 2016, 10:08 PM
#10
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

DrByte:

Yours is the first time i've ever seen that message happen on a Zen Cart site.

I dont think that this is the first time that it has happened, it was just never addressed last time someone mentioned it.

https://www.zen-cart.com/showthread.php?69886-session-error-message-in-error-log&highlight=destroy+uninitialized+session

User of zencart

21 Apr 2016, 12:25 AM
#11
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Warning: session_start(): Trying to destroy uninitialized session

My site is on an Cloud Server where the coded is protected and the images are utilized and destroyed on an hourly basis. Hacking probably isnt the issue.
You are having "Blind" faith that this is not the issue - Suggest that you verify this by doing as recommended

Zen-Venom Get Bitten

21 Apr 2016, 4:01 AM
#12
drbyte avatar

drbyte

Sensei

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

Re: Warning: session_start(): Trying to destroy uninitialized session

batteryman:

I dont think that this is the first time that it has happened, it was just never addressed last time someone mentioned it.

https://www.zen-cart.com/showthread.php?69886-session-error-message-in-error-log&highlight=destroy+uninitialized+session
Hmmmm. Fair observation. Fortunately bettysue got past it, as she's used Zen Cart for many years, and newer versions, since that post.

I confess: I have no idea what the solution is. But I bet it's caused by your "Cloud Server" ... probably some caching or proxying, or unwritable permissions on folders where session data files are stored. Or PHP session configuration has been altered to behave differently than it was before.

Zen Cart isn't doing the session-destroy. The error is happening when Zen Cart tries to start the session. Is it possible that something else outside original Zen Cart code is starting a session before Zen Cart starts one? If so, what and why?

Again, you said you haven't changed any files/etc regarding Zen Cart. But what has your hosting company changed in their "cloud" setup? (I'm using "quotes" because "cloud" has a million possible meanings, and you didn't elaborate, so that's a huge black hole where the problem probably rests.)

.
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.

21 Apr 2016, 6:14 PM
#13
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: Warning: session_start(): Trying to destroy uninitialized session

kobra:

You are having "Blind" faith that this is not the issue - Suggest that you verify this by doing as recommended

batteryman:

I will still look for the possibilities of file tampering.

I did fix the issue although I never figured out what caused it. The session data was somehow being corrupted when saving to the DB, I switched to saving to file and everything started to work correctly.

I also scoured my files and found no trace of tampering. I have backups and am able to compare as suggested. I said cloud server instead of what I actually have so that I give out more information that people need. Just as a precaution. I have been using zencart for 13yrs and this is the very first time this has ever happened so I was baffled myself.

I worked with my programmers and hosting company on the issue yesterday directly and my hosting company made no changes, no updates to any services were recently logged etc.. This is a bit of a mystery.

Just wanted to update you Dr Byte & Kobra.. Thank you for your help.

User of zencart

21 Apr 2016, 6:31 PM
#14
drbyte avatar

drbyte

Sensei

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

Re: Warning: session_start(): Trying to destroy uninitialized session

batteryman:

I did fix the issue although I never figured out what caused it. The session data was somehow being corrupted when saving to the DB, I switched to saving to file and everything started to work correctly.
It might be worth dropping the "sessions" table from the database, and recreating it (the schema for it is in the sql files in the zc_install/sql folder). Perhaps the table was damaged, or contained corrupt data that was confusing its indexes. Rebuilding it (and then switching back to using it) would help confirm things.

.
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.