 |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6  | This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
|
|
|
|

February 4th, 2005, 08:17 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Header Error
Hi. I've been working my way through "PHP, Apache, MySQL Web Development" and currently I'm up to "Chapter 9 - Building Databases."
It took me a while to get it right, but I finally finished all the script for the exercise. I did what the following steps on page 263 told me to do to add a superpower, I typed in a power but when I clicked "Add Power" I got a header error -- Warning: Cannot modify header information - headers already sent by (output started at...
This isn't the first time I've had this problem with this function. Before I started this book I went through another one, and I got the same problem there. I know about the output buffering command, but when I tried it here it didn't work.
Any suggestions?
|
|

February 5th, 2005, 08:33 AM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm only a few pages ahead of you, so have only recently experienced similar problems myself. The problem is caused when you inadvertantly get the server trying to send text to the browser from a non html page, and there is a detailed explanation of the cause on page 149 of the book.
If you are bringing in files using the requre_once statement, make sure you delete any stray spaces or cr/lf characters that are outside the <php ... ?>.
Best of luck,
Alan Bannister
|
|

February 6th, 2005, 11:19 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the response, Alan.
I went back and read the error explanation on page 149. For reference sake, I'll reprint it here:
"A very common error with beginning PHP users is that they fail to understand a very simple fact: Once sent, the headers cannot be sent again. This means that any echo, any space, any tabulation left before the call to the header function will trigger a warning in the script execution..."
Appropriately enough, it's safe to say that I'm failing to understand this since I'm a new user myself. So does this simply mean that header commands need to follow a strict format in order to work properly? Since I'm so used to formatting to my own style and distributing whitespace liberally, it always catches me off guard when I come across an exception to the rule (a perfect example of that being the closing EOD; tag).
Also, regarding the require_once command you mentioned, are the whitespaces and extra characters I should be looking for on the page doing the requiring -- or the required page?
|
|

February 7th, 2005, 07:43 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nevermind. I finally got it to work. Thanks anyway.
|
|

October 7th, 2006, 09:45 AM
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I'm having the same problem here with header() function:
Warning: Cannot modify header information - headers already sent by...
This is pretty annoying because I'm blocked on this error from at least a day.
Thank you for your attention,
Pachuca
|
|
 |