1
$_SESSION Not working on CPANEL.

When we uploaded it to the web host using CPANEL the $_SESSION is not working. But in local using XAMPP it is working.

Suhaib Janjua
  • 3,452
  • 14
  • 56
  • 72

4 Answers4

2

you have make sure to write <?php session_start();?> in the first line of page

waroa kawa
  • 29
  • 7
1

Sessions are enabled by default within any PHP installations and hence do not need any special configuration to enable sessions.

You should make sure you have session_start(); as the first line in any page where you want to use sessions; it should be the very first line, before any whitespace (an empty line, for example).

Hope it helps you.

Jenis Patel
  • 1,577
  • 1
  • 11
  • 20
0

you should insert session_start() in the beginning of the script. Make confirm you call it on every page you need the access to session variables as well

Sankar Smith
  • 338
  • 1
  • 5
  • 14
0

Solved! the problem is, I put all my session on other php file so when include the php I put it under the html code.
I mean like this:

<html> <?php ?> </html>

so when I update it to this

<?php ?> <html>

all stuff are good. thanks for the comment guys <3

Mr Lister
  • 44,061
  • 15
  • 107
  • 146