php file download script no longer working after upgrade to EA4
Hi,
We have a vpn account on hostwinds using whm / cpanel.
Hostwinds support recently upgraded the server to ea4. Since then we have had several issues with php scripts. Most are resolved but we cannot find a solution for an issue with a download script, specifically docx downloads. After downloading and opening, a popup appears saying the file is corrupted. All this used to work fine before the upgrade.
We tried and looked everywhere to no avail so far. Perhaps anyone here can help?
Thanks, Raoul
header("Content-Description: File Transfer");
if($ext == "docx"){
header("Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document");//application/pdf');
}else{
header("Content-type: application/octet-stream");//application/pdf');
}
header("Content-Transfer-Encoding: Binary");
header("Content-Disposition: attachment; filename=\"".$name."\"");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Length: " . filesize($file));
//ob_clean();
//flush();
readfile($file);
Thanks, Raoul
-
Hello @raoultb, Can you browse to WHM >> MultiPHP Manager and share the specific PHP version and PHP handler enabled for this domain? Also, can you let us know the step-by-step instructions for how to reproduce the issue on a test server? Thank you. 0 -
Hi Michael, Thank you for helping with this! Is that in the cpanel login: SOFTWARE > MultiPHP Manager ? It says PHP 5.4 (ea-php54). But there is no exact reference to which PHP handler is enabled. It does show a PHP version dropdown with the following options: PHP 5.4 (ea-php54), PHP 5.5 (ea-php55), PHP 5.6 (ea-php56). The code I posted does reproduce the problem on our server, just set $ext to "docx", replace $name for any name with the docx estension and point $file to an exisiting docx file on the test server. Images and PDF files download well, docx fails as described. This used to work just fine before the ea4 upgrade. I guess php 5.4 is a bit older, can that be the reason? Raoul 0 -
Hello Raoul, WHM >> MultiPHP Manager is only accessible to administrators with root access to the server. It looks like you may not have root access to the server. Can you confirm if that's the case? If so, this is an issue you'll want to report to your web hosting provider so they can investigate further to see what's happening. If you do have root access, feel free to open a 0 -
yes, sorry, I found it after doing a search for "MultiPHP Manager" The PHP handler tab shows suphp for all three php versions I mentioned in my previous post. Is that what you were asking for? Is it better to open a support ticket for this? Thanks again, Raoul 0
Please sign in to leave a comment.
Comments
5 comments