[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

PHP5: can cookies be set in mobile devices? (Iphones)

Hello Experts,

I may be asking multiple questions in one...

I am starting my php sessions as follows:

ini_set('session.use_only_cookies', 1);
$lifetime = 300;

session_name('testSession');
		
session_set_cookie_params( $lifetime, '/', 'localhost', false, true );
		
session_start();

$cookieName = "test";
$value = 4;
setcookie( $cookieName, $value, time() + $lifetime, '/', 'localhost', false, true );
	

Open in new window


but, I am unable to set it when testing using my mobile devices...

so, is there another way to initialize sessions in mobile devices?

Thanks
0
epifanio67
Asked:
epifanio67
3 Solutions
 
GaryCommented:
What version are you using?
Check the cookie settings under Privacy & Security
0
 
Dave BaldwinFixer of ProblemsCommented:
In the sites that I maintain, there is no difference between sessions on mobile and desktop devices.  All the mobile browsers that I'm aware of support cookies.  Try the very simple example on the session_start page:  http://us3.php.net/manual/en/function.session-start.php
0
 
epifanio67Author Commented:
Thank you experts for your help...

I found the issue... see code below....

ini_set('session.use_only_cookies', 1);
$lifetime = 300;//expire in 5 min
session_name('test.session3');
session_set_cookie_params( time() + $lifetime, '/', 'localhost', false, true );
session_start();      

$cookieName = 'test.session3.cookiename';
$testValue = 'testest';
//this works...set cookie ok in firefox, Opera, Chrome, IE10
// setcookie( $cookieName, $testValue, time() + $lifetime );

//this doesn't work.. sets cookie ok ONLY in firefox
setcookie( $cookieName, $testValue, time() + $lifetime, '/', 'localhost', false, true );
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now