error, zend optimizer

This is a discussion on "error, zend optimizer" within the PHP Forum section. This forum, and the thread "error, zend optimizer are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 12th, 2006, 15:59
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
error, zend optimizer

I had an error with phpMy admin yesterday and i installed zend optimizer to fix the problem, it worked really well, but i currently get this error whenever i try to
setcookie("DFlogin", $user, $time);

Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\logout.php:12) in c:\program files\easyphp1-8\www\logout.php on line 48

any ideas?
line 48 isnt the cookie command, im not sure what the problem is.
Syntax maybe?
__________________
www.MonsterCoding.com - Website Programming and Development Services
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 12th, 2006, 16:32
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

Line 12 of your program generates some output - perhaps through a print or an echo statement, or perhaps because you do a ?> followed by a <?php or perhaps even because of a warning message being generated.

When that output is generated, a complete header is automatically sent to your browser based on all the called to header(), setcookie() and other header changing functions up to that point. Once the headers have been sent, you cannot send any more, by accouring to the message you're reporting, you're trying to do so at line 48.

---OOO---

The solution for you is to move the header-effecting statment at line 48 up above line 12, or to save the information you wish to output at line 12 into a variable, and output it after line 48.

In summary, once you've tipped a milk jug over and spilt all the milk, you can't put it the right way up again and magically have all the milk come back.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 12th, 2006, 17:08
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

well i moved it up and i still get the error, so could a mysql connecting or query end headers?

why cant i just change it so it doesnt send headers untill its processed everything? (or how do i?)
__________________
www.MonsterCoding.com - Website Programming and Development Services

Last edited by Compumaniac12; Nov 12th, 2006 at 17:18.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 12th, 2006, 17:44
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

If you show us the source code lines that it's complaining about, then we'll have a better chance of spotting what the errors are. Did the line numbers reported change when you made the alteration? If so, did you try the same technique on the lines newly reported?

You might well be able to disguise what is basically a flaw in you code design (in my view) using ob_start - have a look at that fucntion on the PHP web site - but really you'll do far better to sort out the issue than to hide it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 12th, 2006, 18:17
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

yea it changed,

it says line 11 ends head, and 35 or 37 (depending on an if statement) has the setcookie

line 11 is a <? which obviously i need there...
all this is in my html <head>
It was previously in the <body> section, but there was a php code in the header.


It worked before i installed zend optimizer...
ide rather put it aside personally, because i have more then 1 script with this same problem.

heres the source code for ya:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
    DESIGN
    terrafirma1.0 by nodethirtythree design
    http://www.nodethirtythree.com
    WEBSITE
    DevFile.org by Comps Development
-->
<html>
<head>
<?
$user = $_POST["user"];
$pass = $_POST["pass"];
$forever = $_POST["forever"];


if ((! $user==0) or (! $pass==0)) {
$dbcu2hostname = "localhost";
$dbcu2username = "devfileselect";
$dbcu2password = "nothere";
$dbcu2Name = "devfile";
mysql_connect($dbcu2hostname,$dbcu2username,$dbcu2password) or die(mysql_error());
mysql_select_db($dbcu2Name) or DIE("Table unavailable");

$result = mysql_query("SELECT * FROM `userdata` WHERE `user`='$user'") or die(mysql_error());
 if (mysql_num_rows($result) > 0) {
  while($r=mysql_fetch_array($result)){
$userd=$r["user"];
$password=$r["password"];
mysql_close();
$passwordd= md5($pass);
   if ($password==$passwordd){
    $time = time() + (256 * 24 * 60 * 60);
    If($forever==on){
    setcookie("DFlogin", $user, $time);
    } else {
    setcookie("DFlogin", $user);
    }
   $echo = "Welcome $userd <br />You Will Be Redirected to the Index in 3 Seconds. <meta http-equiv=\"Refresh\" content=\"3; url=http://devfile.game-host.org/index.php\" />";

   } else {
   $echo = "Incorrect Password";
   }
  }
 } else {
   $echo = "Incorrect Username";
 }
}

Include("head.php");
?>
</head>
<body>
__________________
www.MonsterCoding.com - Website Programming and Development Services

Last edited by Compumaniac12; Nov 12th, 2006 at 18:20.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 12th, 2006, 18:56
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

You need the section that includes the setcookie before you output any HTML. In other words, your <? need to go at row 1, column 1 ....

Simply move the top 8 lines of HTML down below the ?> (making sure you don't leave any white space at the top) and it should cure the problem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 12th, 2006, 19:02
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error, zend optimizer

alrighty, thanks abunch, youve been a big help
unfortunatly now my php code is really sloppy.
__________________
www.MonsterCoding.com - Website Programming and Development Services

Last edited by Compumaniac12; Nov 12th, 2006 at 19:05.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
due to, error, zend optimizer

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Getting the &quot;Microsoft JET Database Engine error '80040e14'&quot; error. VegaLA Classic ASP 3 Jan 26th, 2008 00:12
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Error 500 - Internal server error JasonStanley PHP Forum 3 Apr 23rd, 2007 17:56
Zend certified professionals Tim356 PHP Forum 12 Jul 28th, 2005 03:53


All times are GMT. The time now is 21:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42