Solved

getting php error

Posted on 2011-03-12
20
269 Views
Last Modified: 2012-08-14
I'm getting this error on my page:

key [PHPSESSID] doesn't exist in struct (keys:cftoken,cfid)

what does that indicate?  the server is running both php and railo (open source coldfusion)
0
Comment
Question by:COwebmaster
  • 9
  • 6
  • 4
  • +1
20 Comments
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 251 total points
ID: 35116561
Are you trying to share a PHP session with a Coldfusion application?
0
 

Author Comment

by:COwebmaster
ID: 35116606
yes, that's correct.  I moved the site from one domain to another (same server) but now I get that error.  I've checked all the files on ftp for phpsessid and also railo server and can't find any reference to phpsessid.

not sure where that supposed to get created.
0
 
LVL 6

Assisted Solution

by:ramelong
ramelong earned 83 total points
ID: 35116739
If you executes phpinfo() you may confirm if the session is asigned to another variable name (instead of PHPSESSID).
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 166 total points
ID: 35117193
PHP Sessions variables will not be available to ColdFusion and Vice Versa. If you want to use some information between 2 languages, then you would need to make use of something like COOKIE variables.

Use PHP to set values in a COOKIE variable and then use CF to read it, because cookies are stored in users browser, you can read it with other language as well.
0
 

Author Comment

by:COwebmaster
ID: 35117356
someone had coded the site for me and i can't get ahold of him.  On my cfm page, I see:

<cfcookie name="cfmMysessid" value="#cookie.phpsessid#" expires="never">

however, no where in any php page or wordpress file, railo or sql mentions where cookie.phpsessid  is being set and my page is broken.  Where would that be set typically?
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35117423
For WordPress, look at /wp-includes/pluggable-functions.php, you would have wp_setcookie function in there which is used to set cookies...
0
 

Author Comment

by:COwebmaster
ID: 35117467
ok, I checked but I only see the following in that dir:

pluggable.php
pluggable-depreciated.php

I don't see any mention of cookie.phpsessid though in those files or any file under the wp-includes dir
0
 
LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 166 total points
ID: 35117556
Just try to set the missing cookie and see if the error goes away...

here is a WP link

http://codex.wordpress.org/WordPress_Cookies
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 251 total points
ID: 35123336
I'd like to add a bit to the idea published here at ID:35117193.  Cookies should not carry meaningful data in them; instead they should carry a pointer to meaningful data that is stored on the server.  Here is how I might design a sharable session.

Make the application entry point be a PHP script and always use the same entry point.
In that script create a unique id, perhaps the md5() string from the $_SERVER["REMOTE_ADDR"] concatenated to the string value of microtime(TRUE).
Use this string in the file name for the shared session.
Set a cookie with a name like SESSID and a value equal to the unique id.  The expiration date would be zero, meaning at the end of browser life.
Let each successor script read and write from the file named with the unique id.

You will need some kind of session-get and session-put routines which can open and read or write the session data in this file, and you will need some kind of garbage collection routine to clean up the old stuff.  You should also, probably, set the cookie to work across subdomains and across sub-directories.

HTH, ~Ray
0
 

Author Comment

by:COwebmaster
ID: 35129047
so I'm told that phpsessid is automatically set up.  before I moved the site over from the old domain to the new domain (same server), it was working perfectly fine and phpsessid was getting creating.  I then moved the entire site over to another domain on the same server and now the phpsessid does not get created.  The only difference I see is that phpmyadmin was built out on the other domain but not on this new domain.  could that be the issue?
0
 

Author Comment

by:COwebmaster
ID: 35129252
well I set up phpmyadmin on the site but still that phpsessid is not getting created on the site.
0
 

Author Comment

by:COwebmaster
ID: 35129369
so is this a phpsessid error or coldfusion error:

key [PHPSESSID] doesn't exist in struct (keys:cftoken,cfid)
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35129833
so is this a phpsessid error or coldfusion error: --- this is a CF error...
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35129846
0
 

Author Comment

by:COwebmaster
ID: 35130125
well all the files are the same across the old site and the new site and the settings are the same in railo administrator.  not sure why I'm getting that error.
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 251 total points
ID: 35138184
This is not factually correct, or at least not complete: "so I'm told that phpsessid is automatically set up"

In PHP sessions work this way...  Your initial script executes the session-start() command.  PHP looks for a session cookie, but finds none.  This creates a session data set (usually in /tmp/) to hold session data.  It also sets a cookie on the browser with a pointer to the data set.  You can then add and subtract information from the $_SESSION array.  At the time of your script termination, the terminator gets the contents of $_SESSION and writes this information in to your session data set.

In your next script when you execute session_start() the session handler will look for a session cookie and will find the cookie.  Using information in this cookie, PHP will locate your session data set and pre-load the contents of the $_SESSION array with whatever was left from prior scripts.  

To completely understand session handling you need to first understand cookies and the concepts of PHP super-global arrays.  At a minimum, you need to read every page linked from this one.  Sorry it is not easy or quick; there are a lot of variables associated with PHP session handling.  Even the name of the session cookie is "in play" at any given moment.
http://us2.php.net/manual/en/book.session.php

Many of the characteristics of the session handler are influenced by initialization and environmental variables.  If you run phpinfo() in a script that has already run session_start() you may find some of these characteristics in the output.

PHP sessions, as implemented in most PHP installations are incompatible with CF sessions.  There is nothing preventing PHP and CF from sharing a session, but the native implementations do not permit it.  That is why you will need to write your own custom session handler.

Please go back and re-read the information at ID:35123336, and see if that makes sense to you.  If not, please post back with any specific questions.  And don't be afraid to hire a developer for this task - it's not a simple thing and you might get results faster if you hire a pro instead of trying to work it out yourself.
0
 

Author Comment

by:COwebmaster
ID: 35158373
but it sounds like it's a coldfusion error perhaps and not a php error?
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 35158553
It's not an error -- it's just a difference.  Sort of like the difference between English and Chinese.  If you want to be understood in both, you need specialized skills and knowledge.
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35158737
Can you paste the entier error trace ??
0
 

Author Comment

by:COwebmaster
ID: 35161849
I fixed it.  thanks for your help.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question