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
epifanio67Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.