Problem Description
Whenever you run a php file in the browser it shows the following warning message.
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\mock9\pro01.php:86) in E:\xampp\htdocs\mock9\pro01.php on line 168
A variant of above error is after Warning message a function name is appended and then a error message before displaying "headers already sent".
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampp\htdocs\mock9\index.php:4) in E:\xampp\htdocs\mock9\index.php on line 9
Cause and Problem of the Problem
This error "headers already sent" indicates that there are spaces, new lines, other garbage words or in fact any words before an opening tag <?php or after the ending tag ?>.
This same error also occur in fact case 1) if you display any output before sending any header information. Like if you display output like,
echo $query;
before sending header information like before line,
header ("location: pro02.php?pid=$pro_id");
then above error will appear.
It is important to note that with the error message
output started at E:\xampp\htdocs\mock9\pro01.php:86) in E:\xampp\htdocs\mock9\pro01.php on line 168
- It mean that the problem is inside E:\xampp\htdocs\mock9\pro01.php
- The line number that cause the problem is 86 not 168.
Similarly by error message,
output started at E:\xampp\htdocs\mock9\index.php:4) in E:\xampp\htdocs\mock9\index.php on line 9
indicates that,
- Victim file is E:\xampp\htdocs\mock9\index.php
- The problem is in line number 4.
Solution of the Problem
No comments:
Post a Comment