Solved

getting php error

Posted on 2011-03-12
20
264 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 108

Assisted Solution

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

Author Comment

by:COwebmaster
Comment Utility
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
Comment Utility
If you executes phpinfo() you may confirm if the session is asigned to another variable name (instead of PHPSESSID).
0
 
LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 166 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 108

Accepted Solution

by:
Ray Paseur earned 251 total points
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Author Comment

by:COwebmaster
Comment Utility
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
Comment Utility
so is this a phpsessid error or coldfusion error: --- this is a CF error...
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
Comment Utility
0
 

Author Comment

by:COwebmaster
Comment Utility
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 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 251 total points
Comment Utility
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
Comment Utility
but it sounds like it's a coldfusion error perhaps and not a php error?
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
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
Comment Utility
Can you paste the entier error trace ??
0
 

Author Comment

by:COwebmaster
Comment Utility
I fixed it.  thanks for your help.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now