1

In IE, the session work, but in Firefox, it always return empty value.

I have set $_SESSION['apple']='1' in index.php

When executing a Flex 4/flash app that will allow user to browse an image file using filereference for upload to the server (this app is image uploader), the file will then pass to second.php to validate whether it is an image.

In the second.php itself, I have a function that need to retrieve $_SESSION['apple'] value which was set in index.php, it always return empty string in Firefox and Chrome but work on IE9.

Has anyone came across the same problem with $_SESSION on Firefox and Chrome?

How do I make sure the second.php can retrieve $_SESSION?

2
  • Have you tried displaying the session id? see if it differs from script to script? Commented May 20, 2011 at 14:52
  • Flash tends to not play nice with Firefox when sessions are involved. Check the flash-based hits on the server, and you'll most likely see that the session cookie isn't being sent. Commented May 20, 2011 at 14:54

4 Answers 4

1

Adobe Products like Flash/Flex do not pass browser cookies back to the server in other browsers than IE. You need to pass the session ID back to the server on your own for every request from flash.

in PHP, you can enable the session with the following code:

 if (isset($_GET['session_id'])) session_id($_GET['session_id']);
 session_start();

If it doesn't work out for you and you have the suhosin/hardenet patch installed, you might have to turn session_cookie encryption off. (can't remember the exact option - one of my corworks once stubled upon such an issue)

Sign up to request clarification or add additional context in comments.

Comments

1

See corresponding bug and workaround.

You can find a lot of other bugs with the same problem:

1 Comment

arh, that old way to fix it. Any more method? How to retrieve $_SESSION value within flex application that will pass as a parameter to php?
0

As PHP runs on the server, it's not very likely it's the result of the browser. Most common problem is: did you use session_start() in all your php files that use the $_session in any way?

1 Comment

Yes. Both has session_start();
0

Try using AMFPHP, it will help you develop with PHP + Flex.

http://silexlabs.org/amfphp/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.