Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 20th, 2006, 04:07 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default "headers already sent" - one cure

Hi again guys.

Re: Passing variables with cookies pp. 49-52

If you are using Notepad as your text editor and you save your file as 'somename.php' with UTF-8 encoding, you will always get "headers already sent". Apparently:

If you save your php script as UTF-8, HTML output will start at line 1 (script tag start) and setcookie() will fail.

If you save the page as ANSI setcookie() will work properly.

As an aside, I was able to set session.auto_start=0 in the php.ini file and the manual session_start() command worked for this page.

If anyone gets a "Headers already sent" error, check the encoding of your script page.

UTF-8 encoded scripts start output at the php tag declaration.

This was probably covered early in Ch. 1 and I just missed it, but for those of you who also missed it, here it is again!

  #2 (permalink)  
Old February 20th, 2006, 07:05 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have changed text editors to a charityware text editor called "Vim" as a result of the encoding (and lack of line numbers, sytax tools, color highlighting, etc.) issue and realizing that using Notepad is a "stone age", ineffective way to go if I am going to be a programmer.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding sub headers.... rupen Crystal Reports 6 May 14th, 2007 04:56 AM
CheckBoxList Headers Ric_H C# 0 June 26th, 2006 10:29 AM
WHat is "http headers"? gilgalbiblewheel Classic ASP Databases 1 September 14th, 2005 11:59 AM
Help With PHP Headers!! majingohan Beginning PHP 1 April 17th, 2005 04:16 AM
Headers skicrud Beginning PHP 2 October 10th, 2003 02:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.