php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15148 Troubbles with setcookie (on Unix Solaris php)
Submitted: 2002-01-21 10:31 UTC Modified: 2002-01-21 11:35 UTC
From: alexis dot escobar at micrologus dot cl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.1.1 OS: Solaris 5.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alexis dot escobar at micrologus dot cl
New email:
PHP Version: OS:

 

 [2002-01-21 10:31 UTC] alexis dot escobar at micrologus dot cl
Hi guys...
I had a script (sw.php) who works fine on php 4.1.1 on Windows NT, but when I try to run it on Solaris show me the following error:

Warning: Cannot add header information - headers already sent by (output started at /www/htdocs/db-include.old:2) in /www/htdocs/sw.php on line 46

sw.php, call via OCI8 an Oracle8 database through db-include.old file who assigns username, password and string connection:

<---- sw.php ----->

$rut=$HTTP_COOKIE_VARS["rut_alum"];
require('db-include.old');
$Connection = OCILogon(DB_USER,DB_PASS,DB_NAME);
$q_semeinsc =  "select ...";

$statement1 = ociparse($Connection, $q_semeinsc);
ociexecute($statement1, OCI_DEFAULT);

while (OCIFetchinto($statement1, &$semeinsc, OCI_ASSOC+OCI_RETURN_NULLS))
		{
		$vanual = $semeinsc[VAR];
                ...
		}
if(!isset($nsemestre))
		{
		$server_name = getenv("SERVER_NAME");
		$http_host = getenv("HTTP_HOST");
		setcookie("nsemestre", $vanual, time()+3600);
		}
<---- End ----->

The warning points to the setcookie line. The script fetch the results of Database, but show that ugly warning...

Can u help me? I'm very desperated...

Greetings Alexis from Chile
(sorry for my english)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-21 11:28 UTC] edink@php.net
Please make sure that nothing is printed from
db-include.old. If something gets printed (anything: space,
error message) the headers get sent so it is impossible
to add cookie headers at that point.

 [2002-01-21 11:35 UTC] alexis dot escobar at micrologus dot cl
Well, I've revise the code on db-include.old again, and I saw a white line between code and <?...like this:

<?

DEFINE(user, ...)
DEFINE(pass, ...)
DEFINE(conn, ...)
?>

So, I remove that line and code responds fine! :)

Thank you Edink!

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 01:01:27 2025 UTC