Yes,again this problem and this warning "header already sent". But this time I do not know why because the error occur in the first line of script(I can swear that I did not echo anything!). I use AJAX in my script and it is the first time that I front this problem.
I send the url and the data by AJAX to the php script that parse and return the result but in the first line where I include(by require_once) a script, I front a warning and be sure that there is no echo or something like this before errored line!
Header already sent![solved]
Moderator: General Moderators
-
persiangulf
- Forum Commoner
- Posts: 30
- Joined: Tue Jan 29, 2008 12:04 pm
Header already sent![solved]
Last edited by persiangulf on Tue Jan 29, 2008 12:55 pm, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Header already sent!
Make sure there are no space or newline characters characters before the <?php and after the ?> in any files. In files that contain only PHP, the ?> in not required and removing it can eliminate the problem of having hidden space or newline characters at the end of a file.
(#10850)
Re: Header already sent!
Code: Select all
error_reporting(E_ALL);Also, it's not only echo's/print's that gives you these problems. A common issue is if you have a blank row before the first <?php or if the script generates an error that's not displayed on the page itself but within the code. The later you can usually find by a 'View Source' at the generated page.
-
persiangulf
- Forum Commoner
- Posts: 30
- Joined: Tue Jan 29, 2008 12:04 pm
Re: Header already sent[solved]!
Yes,I solved it!But the problem was not the thing that you said.The problem was the type of encoding the saved script!Your advice helped me a lot because I said to myself let me see if the encoding is not problem because I use Dreamweaver under Linux and by wine(I said to myself may be the default encoding make this problem).
Thanks a lot because of your big advice.(add encoding problem to your list
)
Thanks a lot because of your big advice.(add encoding problem to your list
Re: Header already sent!
'C) None of the above...'-problems like this is usually found by just discussing the issue. It's hard to spot errors if you don't think out of the box.
Glad you worked it out.
Glad you worked it out.