Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

php file download script no longer working after upgrade to EA4

Discussion in 'EasyApache' started by raoultb, May 27, 2019.

  1. raoultb

    raoultb Registered

    Joined:
    May 27, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,555
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. raoultb

    raoultb Registered

    Joined:
    May 27, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,555
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. raoultb

    raoultb Registered

    Joined:
    May 27, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,555
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice