I'm having trouble with a login system using PHP. I have a file called session.php which I include inside another PHP file called index.php.
This is the code inside:
It works fine in my machine using XAMPP with PHP 7.3. If I upload it to an apache server with PHP 7.3 (as well) and go into index.php;
I then check the value of $user and it's NULL.
However if I switch to PHP 7.0 it works just fine and $user is now an object as it should be.
I need to use PHP 7.3 because of compatibility with a library.
Also, if you go to the session.php file directly instead of including it from another file it works fine (even with PHP 7.3).
I've tried:
- Putting the session_start() bit inside the index.php at the start of the file.
- Making index.php content nothing but `include 'session.
But got nothing.
Also, I don't have access to the logs so I can't check there.
I tried var_dumping stuff to see if the session.php file is being called at all and up until the if(isset($_SESSION['myweb-login'])){ line it shows stuff but nothing after...
Источник: https://stackoverflow.com/questions/570 ... ine-in-7-0