I have a website that is now several years old, it mainly offers downloads.
In any case, since moving the server cannot load files, because now it gives an error of 500 errors, and in the log files it brings this error:
Invalid header from script. Bad title = 1: index.php
The only code that is related to this that I see anyway is this:
$file = DOWNLOAD_FOLDER. '/'. $productOptionDetailEntity->file;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file) + 1);
ob_clean();
flush();
readfile($file);
exit;
}
Now, if I just output:
$file = DOWNLOAD_FOLDER. '/'. $productOptionDetailEntity->file;
if (file_exists($file)) {
readfile($file);
exit;
}
It outputs a lot of ciphertext, so it is clearly reading something.
What I read is that the headers are incorrect, but after reading the content downloads on php.net, as well as on other websites, it looks fine.
Can anyone scream why I get these errors?
thank