PHP session question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

PHP session question

Post by prue_ »

hi everyone, I hope someone could help me with this. I have a login page that uses session.. it's working perfect on a but when I upload it on other server, session is not working.. would it be a server problem only? what could be the problem? thanks. here's my code: (domain.com/login.php)

Code: Select all

code deleted
Last edited by prue_ on Mon Nov 23, 2009 8:10 pm, edited 2 times in total.
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: PHP session question

Post by Weiry »

prue_ wrote:when I upload it on other server, session is not working
Can you elaborate on this, are you getting any errors?
Usually PHP will throw a notice or a warning if sessions cant be established.
You may also need to check if sessions are enabled. I know that the php.ini has some session configurations there.

Try placing this at the top of a file with a session for debugging.

Code: Select all

error_reporting(E_ALL);
If that doesnt really help, try something like this to see if the session will actually start:

Code: Select all

 
if(!session_start()){
    print "Session failed to start!"; exit;
}else{
    print "Session successfully started!";
}

Edit:
Also, are you trying to run PHP script on a HTML page???
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: PHP session question

Post by prue_ »

Edit:
Also, are you trying to run PHP script on a HTML page???
oh my gosh, it's working now.. I renamed everything to .php... thanks a lot.. how come on some server - html with php code works? thanks thanks thanks!
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP session question

Post by jackpf »

Server configuration?
Post Reply