Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session data working on local but not on ipage server

Tags:

php

I have been trying to debug this problem for hours but couldn't. I have these two files:

My first file:

 session_start();
 $_SESSION['user'] = '1';

My second file:

session_start();
print_r($_SESSION);
echo $_SESSION['user'];

But The second file echoes an empty array. This works fine on my localhost but didn't work on online server. I also have 'register_globals' turned off in php.ini

like image 225
Anita Sharma Avatar asked Jul 05 '12 06:07

Anita Sharma


3 Answers

If you are using cPanel goto cPanel > php.ini QuickConfig >

Check for

session.save_handler = files
session.save_path = /tmp

If you have still facing the problem ask your cPanel guys they will help you

like image 122
Radhakrishna Chowdary Avatar answered Nov 15 '22 04:11

Radhakrishna Chowdary


i was also facing the same issue with ipage hosting now it is solved with Radhakrishna Chowdary`s help i did following-

  1. login to your ipage hosting account
  2. go to Additional Tools -> CGI and Scripted Language Support
  3. there choose PHP Scripting
  4. there you will see "Edit your php.ini file for PHP 5.3" click on edit.
  5. change value of session.save_path `s value to "/tmp"
  6. its done working now :)
like image 32
vivex Avatar answered Nov 15 '22 03:11

vivex


iPage requires you to specify the session_save_path() within your script. Like so :

session_save_path("your home directory path"/cgi-bin/tmp);
session_start();

Take a look at this iPage Knowledgebase article for further reference.

like image 24
filip Avatar answered Nov 15 '22 03:11

filip