Php Session_start doesn t work

idk why session_start() doest t work even if i write it correctly above the tag and it’s the first code of all in all pages that need session_start()

maybe this is server issue??

my acc : leaxiano.ml

It does work, unless your code it wrong.

Can you share your PHP code, as well as any error messages?
Thanks

That’s it? It started a PHP session, but doesn’t know what to do with it (As you have no other code about what to do with the session). What are you trying to accomplish? Also, you forgot the DOCTYPE declaration in the screenshot that you deleted.

no it s not the full code !!!

idk why but when i try to write the code it gives me 403 error (forbidden) :frowning:

Can you show the full code? I can’t troubleshoot anything from one line.

There is probably an error somewhere. Can you share the full code please?
Thanks.

you can find the code in leaxiano.ml/code.php

That page doesn’t have a PHP open tag, so the PHP code is just printed in the browser instead of being executed as PHP code.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Is there any error?
Like Notice : Undefined variable: _SESSION or any others.

Did you define any session?

Try this code and let me know the output.

session_start();
if(!isset($_SESSION['user'])){
  echo "Session Not Created";
  $_SESSION['user'] = "demo";
}else{
  echo "User ".$_SESSION['user'];
}

output :
Session Not Created

session_start doesn t work so ntg works

Did you refresh your page? if yes, what is the output?

Output:

user demo

That means session_start() is working and session “user” has been created.

2 Likes

As I also said in your other topic: please don’t create multiple topics about the same issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.