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!

XSendFile serves zero byte files

Discussion in 'Workarounds and Optimization' started by Benjamin D., Jul 25, 2018.

  1. Benjamin D.

    Benjamin D. Well-Known Member

    Joined:
    Jan 28, 2016
    Messages:
    103
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    I have 2 servers, one on CentOS 6.1 and the other one on CentOS 7.5. They both have the exact same software configuration WHM 72.0 and using the Transfer Tool, I synced all the settings, then MANUALLY I had to spend at least 2 hours comparing everything and there were A LOT of things that did not transfer. A real nightmare. Now that everything is the same, I went to check one of the sites on the machine and XSendFile serves zero byte files!

    I tried to create a .conf file and I've been messing for an hour trying to get it to include, but it doesn't include. I don't understand how it can be that hard to sync 2 machines. If it works on the old one, why doesn't it work on the new one?

    When I restart Apache, I get a yellow warning: restartsrv_httpd[11354]: [Wed Jul 25 01:39:41.840864 2018] [so:warn] [pid 11391] AH01574: module xsendfile_module is already loaded, skipping

    WHY does it skip and why is it already loaded? WTF? How do you fix that error? I tried to uncheck it from EasyApache4 and then Apache wouldn't start anymore. I then immediately put it back on and then Apache came back, but it's still the same, it serves 0 byte files and there's that yellow warning upon Apache restart. I spent many hours on this today and I'm exhausted, I don't understand what the F is wrong with WHM 72.0 why is it so clunky?

    I also tried to put the DIRECTORY conf in WHM > APACHE CONFIGURATION > POST VIRTUALHOST INCLUDE :

    <Directory "/home2/thatuser/thatsite.com/">
    XSendFile on
    XSendFilePath /home2/thatuser/public_html/files/
    </Directory>

    But it still is the same.

    When I go in EASYAPACHE4 and uncheck Mod_XSendFile, when provisioning, it says there are errors:
    Building global cache for cpanel...httpd: Syntax error on line 27 of /etc/apache2/conf/httpd.conf: Syntax error on line 1 of /etc/apache2/conf.modules.d/mod_xsendfile.conf: Cannot load /usr/lib64/apache2/modules/mod_xsendfile.so into server: /usr/lib64/apache2/modules/mod_xsendfile.so: cannot open shared object file: No such file or directory

    Configuration problem detected on line 0 of file /etc/apache2/conf.modules.d/mod_xsendfile.conf: : Cannot load /usr/lib64/apache2/modules/mod_xsendfile.so into server: /usr/lib64/apache2/modules/mod_xsendfile.so: cannot open shared object file: No such file or directory

    EDIT: Been trying everything I can for the last 4 HOURS!! I'm pulling my hair out, ANYBODY CAN HELP???
     
    #1 Benjamin D., Jul 25, 2018
    Last edited: Jul 25, 2018
  2. Benjamin D.

    Benjamin D. Well-Known Member

    Joined:
    Jan 28, 2016
    Messages:
    103
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    Problem solved. This can be closed.
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,309
    Likes Received:
    393
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What was the solution to your issue?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Benjamin D.

    Benjamin D. Well-Known Member

    Joined:
    Jan 28, 2016
    Messages:
    103
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    After very long hours of pulling my out and finding absolutely nothing helpful online, I stumbled on the solution completely randomly. To make XSendFile work under CentOS 7.5 you have to put the directory rules under a custom included CONF file (both SSL and STD) without the actual DIRECTORY node. So instead of:

    <Directory "/home2/thatuser/thatsite.com/">
    XSendFile on
    XSendFilePath /home2/thatuser/public_html/files/
    </Directory>

    It had to be put like this:

    XSendFile on
    XSendFilePath /home2/thatuser/public_html/files/

    I cannot believe it took 4 hours to fix this. I would have thought EasyApache4 would have been easier. I kind of miss EA3, where you could install custom EA modules. It was working better and setup was simpler a couple years ago. Nowadays, everything is so complicated and obfuscated for no valid reason.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,852
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Benjamin D.,

    Part of the issue in this particular case is that mod_xsendfile isn't a standard module offered by Apache and it was never fully developed with Apache version 2.4 in-mind. There's some discussion of this on the following StackOverflow thread:

    https://serverfault.com/questions/879130/is-mod-xsendfile-deprecated

    We do offer the following guide for installing custom packages with EasyApache 4:

    Tutorial - Building Custom Packages For EasyApache 4

    Are there any other custom Apache modules not offered in EasyApache 4 that you'd like to see offered in the future?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Benjamin D.

    Benjamin D. Well-Known Member

    Joined:
    Jan 28, 2016
    Messages:
    103
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    Yes I remember that SO post but it did not provide anything useful in my case, what it did provide is a .c file to compile, but I didn't want to go that route in fear to mess something up on my server. No really, EA4 experimental RPM gave me part of the solution by letting EA4 install the XSendFile module in WHM and what was left for it to work was the configuration bit I mentioned in my previous post... which I found out completely randomly after trying for 4 hours.

    If I had a suggestion is to move XSendFile module to the standard EA4 RPM. XSendFile has worked the same for at least a decade, so there's no reason to hide it from the standard EA4. It really works fine and there's nothing comparable in the standard modules.

    Props to this gentleman: https://features.cpanel.net/topic/mod_xsendfile-support

    Please close this thread.
     
    #6 Benjamin D., Jul 26, 2018
    Last edited: Jul 26, 2018
    cPanelMichael likes this.
Loading...
Similar Threads - XSendFile serves zero
  1. kiavaco
    Replies:
    9
    Views:
    989

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