Initially, when I was designing the site, I worked with sessions on only one page, where I declared
session_start (); Then I needed to extend this function to the entire site. To do this, I placed
session_start () in the
config.php file, which in turn connects to each php file of the site. This is where the problems arose …
The site structure is as follows (header files):
These files are connected to every page on the site.
And the pages are divided into categories in which there is no session error:
And the files in which the error occurs:
How can you overcome this error?
Warning: session_start () [function.session-start]: Cannot send session cache limiter – headers already sent (output started at
S: \ home \ localhost \ www \ web_shop \ faqs.php: 1) in
S: \ home \ localhost \ www \ web_shop \ config.php on line 2
Answer 1, authority 100%
The error indicates that the function cannot set the HTTP response headers, since data has already been output to the response body.
The header function (which in turn is called by session_start) can only be used before the response body is displayed.
To fix the error, place the config.php connection at the very beginning of the file text.
Answer 2, authority 22%
Thanks to the help of comrade ToRcH565 we managed to fix this error. The point was that I did not write
& lt;? Php from position zero.
Answer 3, authority 22%
Maybe someone will help!
Opened the file in Notepad ++ and saved it with UTF-8 encoding without BOM.
And uploaded the file to the hosting.
After refreshing the page, the warning disappeared!