PHP Session variables; works on one computer, not on another

625

So I have a development computer, and a production server. On the dev computer everything works great. I copy the site to the production server and my session variables aren't working.

I am using a simple login script and register the session username after the person logs in.

session_register("myusername");

I then put in a catch for testing purposes right below that.

if(isset($_SESSION['myusername'])) {
                echo "set";
            }
            else {
                echo "not set";
            }

On the dev computer it prints out set. On the production server it prints out not yet. The interesting part, is that the exact same code works on another part of the site perfectly fine.

I'm working on an inventory system, and am using the registered login name to generate a change log so that it's possible to see who did what to a system.

Like I said, this same code works fine on another part of the system (the reason I'm not reusing it is because they are separate logins, though into the same AD database).

Is there something obvious I'm missing that would cause the same code to:

A. Works on one part of the site and not another. B. Works on the test computer in both places, and works on the development site in the original login.

Thanks

People are also looking for solutions to the problem: php - Laravel view rendering issue

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.