• This store mainly does PDF downloads. We have X-sendfile turned on. We are the developer and hosting provider. Other sites (not WC) on the same server are using X-sendfile OK. Server is apache-2.

    PHP is 8.2 fpm. It appears that WC won’t use X-sendfile because FPM does not support a function that WC calls to test whether X-sendfile is installed.

    Is there any workaround?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter nikdow

    (@nikdow)

    the function that WC calls is apache_get_modules which isn’t present in PHP-FPM

    Hi @nikdow

    Thank you for reaching out — we’re happy to help!

    WooCommerce supports PHP versions 7.4 and higher, including PHP 8.0 and 8.1. The specific PHP version support can vary depending on the WooCommerce version, so it’s always best to check the official WooCommerce documentation or release notes for the most up-to-date information.

    Regarding PHP-FPM (FastCGI Process Manager), WooCommerce works with both PHP-FPM and without it. PHP-FPM is a FastCGI implementation for PHP that offers significant performance improvements, especially under high load, by managing pools of worker processes.

    Key Points:

    • PHP Version: WooCommerce supports PHP 7.4 and higher.
    • PHP-FPM: WooCommerce is compatible with PHP-FPM and can benefit from its performance enhancements.

    For reference:

    I trust that points you in the right direction, but if you have more questions, let us know.

    We’re happy to help.

    Thread Starter nikdow

    (@nikdow)

    Sorry but your answer does not address the question.

    WC X-sendfile for downloads does not work with any version of FPM because your software attempts to use PHP function apache_get_modules which is not supported in any PFM version.

    I’m asking for an alternative way, for example to override that check and force X-sendfile regardless. Otherwise it isn’t available in our configuration.

    Hello again @nikdow ??

    I went ahead with pinging our team, internally, for further insight. The code referenced above comes from here.

    There’s no direct way to override?that?check specifically. Feel free to open a bug report on GitHub, to highlight that shortcoming and maybe request a filter to be added to the?apache_get_modules?check. That’ll have to be a conversation with the developers, though.

    Alternatively, consider unhooking the download_file_xsendfile function itself and then replace it with your own customized one in either a custom plugin or theme functions file. Here’s an example of how to unhook that function.

    I hope this is helpful! Please let us know if you have any further questions or concerns.
    We will be happy to help you further.

    Thread Starter nikdow

    (@nikdow)

    Thanks, I had tried that approach and succeed in unhooking the function and writing my own but hadn’t succeeded in getting it working on the live server. I’ll try that again, and post the code here if I can get it to work.

    That’s brilliant, thanks for letting us know. We’ll be around, let us know how it goes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.