Hi,
VikAppointments starts the session during the “init” hook. If you are obtaining that error, you are probably using a theme/plugin that echoes (displays) something before (or during) the WordPress initialization.
It is possible to include an additional PHP test code to detected who is sending the headers too early.
You should open via FTP (or through the plugin editor) the file mentioned in the error log:
wp-content/plugins/vikappointments/libraries/adapter/session/handler.php
Here you should replace the code at line 31 into the following one:
if (headers_sent($file, $line))
{
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'log.txt', "File: $file\nLine: $line\n");
}
else
{
session_start();
}
At this point, when you try to visit a page from the front-end, this code should be executed and a log file will be generated, which will contain the file and the line that are currently sending the headers. You can find this file at the path below:
wp-content/plugins/vikappointments/libraries/adapter/session/log.txt
Thread Starter
Alex
(@alexandronalin)
Hi,
unfortunately no output. The log.txt have just 2 line inside:
File:
Line: 0
nothing else 🙁
log.txt timestamp changes every minute, so I assume your code is executed
Hi,
if you are obtaining a similar log, the headers are sent outside from PHP. There’s no article on the web that explains why and when headers_sent fills the name of the file with an empty string.
I believe that you should contact your hosting provider to analyze your situation.
I found a similar case on StackOverflow, but unfortunately none was able to provide a relevant solution.
I would suggest to try migrating the website into a different server/hosting, but this procedure might take you some time.
You can also try to deactivate all your installed plugins one by one. In case this procedure solves the issue, one of your plugins probably contains PHP code saved with a wrong encoding (probably UTF-8 BOM).