• Resolved pierregofu

    (@pierregofu)


    Hello, I have an issue I can’t resolve myself.
    When I want to download a pdf from my website ( at the moment hosted with XAMPP ), I get this message :

    Warning: fopen(): remote host file access not supported [my file… ] in C:\xampp\htdocs\wordpress\wp-content\plugins\waterwoo-pdf\inc\tcpdf\include\tcpdf_static.php on line 1859

    Warning: fopen(my file ): failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\wordpress\wp-content\plugins\waterwoo-pdf\inc\tcpdf\include\tcpdf_static.php on line 1859
    Unable to watermark this file for download. Please notify site administrator.

    So after some resarch I found out that the problem came from line 1855
    $filename = ‘file://’.$filename;
    I removed ‘file://’
    So now I have
    $filename = $filename;
    ( that is a nonsense )

    Now it works… But will it work when I’ll host my server ( not with localhost ) ? How can I solve the problem without changing the code ?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Little Package

    (@littlepackage)

    Warning: fopen(): remote host file access not supported [my file… ] in C:\xampp\htdocs\wordpress\wp-content\plugins\waterwoo-pdf\inc\tcpdf\include\tcpdf_static.php on line 1859

    Hi there @pierregofu and thanks for your message. I’d like to address the first part of your message with the “Warning” above because I think it answers the question: Your PDF must be hosted on the same server as your WP installation. The free version of this plugin has no provision for accessing files on remote servers. I hope this makes sense!

    Thread Starter pierregofu

    (@pierregofu)

    Hi, thanks for your answer. Actually everything is hosted on my computer at the moment, the website and the pdf I want to download from this website.
    The pdf file is in xampp/htdocs/wordpress/wp-content/uploads/woocommerce_uploads, so necessarily on the same server.

    I also tried something I read on stackoverflow : on line 1859 in tcpdf_static.php, I wrote
    return fopen($_SERVER[‘DOCUMENT_ROOT’].$filename, $mode);
    instead of
    return fopen($filename, $mode);

    Then I just get this error message :
    Warning: fopen(C:/xampp/htdocs/file://\xampp\htdocs\wordpress/wp-content/uploads/woocommerce_uploads/2020/06/Lucius-Le-mur-dhadrien_312_1601653690.pdf): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\waterwoo-pdf\inc\tcpdf\include\tcpdf_static.php on line 1859

    I don’t understand much about this.

    Thanks for your help

    Plugin Author Little Package

    (@littlepackage)

    file://\xampp\htdocs\wordpress/wp..

    Interesting the mix of forward and back slashes..

    I assume you have listed the absolute path of the file in the Woo product settings?

    Please keep in mind, once you start changing TCPDF code and WaterWoo code, I cannot help as it’s not collaborative and I’ve lost bearing.

    • This reply was modified 4 years, 1 month ago by Little Package. Reason: blockquote quoted code
    Thread Starter pierregofu

    (@pierregofu)

    I assume you have listed the absolute path of the file in the Woo product settings?

    Hmmmmm yes I wrote the absolute path… So now I’ve changed it to relative and it works. Sorry I’m quite a newbie.
    It also makes me remember that I’ll have a problem with absolute paths when migrating the website to a real host.

    Please keep in mind, once you start changing TCPDF code and WaterWoo code, I cannot help as it’s not collaborative and I’ve lost bearing.

    Precisely I asked for help because I don’t want to change anything in the code.

    Thanks for you help.

    Plugin Author Little Package

    (@littlepackage)

    Hi @pierregofu
    Did you get this working? I know that WooCommerce accepts absolute paths and URLs for its products, and that the free version of WaterWoo will accept files hosted under the same domain as the WooCommerce installation. I’m not sure why relative path worked in this case, but if it did and you’re happy with that – great!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Failed to open stream’ is closed to new replies.