Forum Moderators: coopster

Message Too Old, No Replies

PHP Session Error

         

wfernley

3:40 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello. I created a simple login with DW MX. It works on my server which is IIS, but when I upload to to an Apache server I get this error:

Warning: Cannot send session cookie - headers already sent by (output started at /web/Wes/firestorm/clients/sktech/Connections/sktech.php:9) in /web/Wes/firestorm/clients/sktech/dbedit/login.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output started at /web/Wes/firestorm/clients/sktech/Connections/sktech.php:9) in /web/Wes/firestorm/clients/sktech/dbedit/login.php on line 4

Can anyone explain this error to me?

Thanks :)

pete_m

3:54 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



Hi wfernley

Basically something is writing to the page before the session_start() command - which is not allowed.

It looks like you have a session_start command at line 4 of login.php, but something is writing to the page before this at sktech.php line 9 (i.e. an echo(), print_r(), etc.)

You can cure this by making sure nothing writes to the page before the session_start(). I hope this makes sense!

wfernley

4:00 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes that does make sense. :)
The only thing I have before the session_start is a require to the connection of the Database.

<?php require_once('../Connections/sktech.php');?>

Could this cause the problem?

bcolflesh

4:01 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



pete_m is correct, also watch for invisible return characters or tabs, since this is moving from IIS to *nix - backspace out any "empty" lines at the top, or use a DOS to UNIX converter on the file.

wfernley

4:06 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK I just put the require right after the session_start. This brings up two problems, one which it has been doing from the start. The one it has been doing from the start is displaying the content from the main page, which after you login to it sends the user too.

The other problem is after you login and it takes you to the main page, it gives this error:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /web/Wes/firestorm/clients/sktech/dbedit/login.php on line 17

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /web/Wes/firestorm/clients/sktech/dbedit/login.php on line 18

Can you make any sense of this one :)

I can supply the code on line 17 & 18 if you need it.

pete_m

4:19 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



It sounds like the best idea would be to move the line:
<?php require_once('../Connections/sktech.php');?>

back to where it was, and to edit the sktech.php file manually.

Look at line 9 of sktech.php - does it have any commands that write to the page? Does it seem to be a blank line? As bcolflesh says, there could be an invisible character there. If line 9 is blank, just remove it.

wfernley

4:24 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey thanks for the help. It turns out the problem was in the connection php file. I had a bunch of junk code that I have no idea how it got there. Anyways its fixed . :) Thanks for your help.

Wes