I have found the issue,
Its when I was uploading the files to servers it was automatically appending the white blank lines at the end of the AppController and also another controller files.
So when I removed the blank lines from that files it is working fine again
//To detect the file which have issue or extra space or early header start
//File location : vendor/cakephp/cakephp/src/Network/Session.php
public function write($name, $value = null)
{
if (empty($name)) {
return;
}
if (!$this->started()) {
$this->start();
}
$write = $name;
if (!is_array($name)) {
$write = [$name => $value];
}
//remove the comment from bottom line and run your code it will
//show you the exact file from where you have to remove the blank space
//session_start();
$data = $_SESSION ?: [];
foreach ($write as $key => $val) {
$data = Hash::insert($data, $key, $val);
}
$this->_overwrite($_SESSION, $data);
}
Small issue but took long time to detect it,hope this will help you all.