Re: Headers and sessions in php .cgi

From: Date: Sat, 10 Jan 2004 19:04:59 +0000
Subject: Re: Headers and sessions in php .cgi
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174210@lists.php.net to get a copy of this message
On Sat, 10 Jan 2004 17:44:18 +0100 (MET), you wrote: >I have a problem setting my headers right with php running as .cgi. I >have to specify a Content-type for the cgi file to work. But how >should I do both that and start a session? > >I have a few options: > >#! /usr/local/bin/php ><?php > session_start(); > print 'Content-type: text/html' . "\n\n"; > >This way $_SESSION['count'] stays unset even though I say >$_SESSION['count'] = 1; in my program. > >To swap the two lines won't work because I heard \n\n terminates the >header portion. Anyway, here goes: Stupid question: Have you tried header ('Content-type: text/html'); I'm pretty sure it will work.

« previous php.general (#174210) next »