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_set_cookie_params( $lifetime, '/', 'localhost', false, true );

$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?

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.

What version are you using?
Check the cookie settings under Privacy & Security
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:

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_set_cookie_params( time() + $lifetime, '/', 'localhost', false, true );

$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 );
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

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.