php file download script no longer working after upgrade to EA4

raoultb

Registered
May 27, 2019
3
0
1
Europe
cPanel Access Level
Website Owner
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?

Code:
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,218
463
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.
 

raoultb

Registered
May 27, 2019
3
0
1
Europe
cPanel Access Level
Website Owner
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,218
463
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 support ticket so we can take a closer look. You can post the ticket number here and we'll link this thread to it.

Thank you.
 

raoultb

Registered
May 27, 2019
3
0
1
Europe
cPanel Access Level
Website Owner
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,218
463
Hello Raoul,

Thank you for sharing the requested information. I recommend opening a support ticket in this case so we can access the affected system to see if anything stands out as the cause of the reported problem. Post the ticket number here once it's opened and we'll follow along.

Thanks!