Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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!

Reply With Quote
  #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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.