|
Posted by Darko on 07/13/07 13:52
On Jul 13, 11:37 am, bashar <bashar.abdul...@gmail.com> wrote:
> On Jul 13, 11:44 am, Markus <derernst@NO#SP#AMgmx.ch> wrote:
>
>
>
> > bashar schrieb:
>
> > > Hi,
>
> > > I keep getting this error: Warning: session_start() [function.session-
> > > start]: Cannot send session cookie - headers already sent by (output
> > > started at c:\wamp\www\testlogin.php:1) in c:\wamp\www\testlogin.php
> > > on line 2
>
> > > All people are referring to extra line at the end and related issues,
> > > but it doesn't seem to be my problem:
>
> > > Here is the code:
> > > ====================
> > > <?php
> > > session_start();?>
>
> > There must be some kind of output at line 1 before the <?php statement.
> > If you don't see a space or other character there, my guess is that you
> > use some UTF-* encoding, probably UTF-8, and your code editor inserts a
> > BOM at the beginning of the file, but does not display it.
>
> > To find out, you need to get a code editor such as VIM or Maguma, and
> > open the PHP file. If you see some strange characters before <?php,
> > delete them, and your script should work.
>
> > HTH
> > Markus
>
> Very good point. it is indeed UTF-8, but I tried VIM same thing. It is
> begin of the file ;/
Try writing a c-program of 5 lines that will give you characters on
the standard output. It is hard to do it in another way, since usually
editors are "smart" and tend to hide the information you "don't want
to see". Here, compile this and run it:
#include <stdio.h>
int main()
{
int c;
while ( (c = getchar()) != EOF )
putchar(c);
return 0;
}
save it as x.c and compile it by
gcc -o x x.c
then run it as ./x < script.php (where script.php) is your php file
you have problems with.
if you see 2-3 characters on the screen before <?php then that is your
problem, which most probably is (faced it, like everyone else here,
probably)
Another problem that you might have is your php file being included by
another php file.
All of these problems are automatically avoided by using proper
templating systems. Think about smarty, for an example
(php.smarty.net)
Cheers
Navigation:
[Reply to this message]
|