The downloads are failing and I'm seeing this error

The downloads are failing and I'm seeing this error in the server logs:

PHP Fatal error: ob_end_flush(): Cannot use output buffering in output buffering display handlers in /home/username/public_html/wp-includes/functions.php on line 3553

Thanks!
-Sandor

  • Michael Bissett

    Hey Sandor, Michael here! :slight_smile:

    Sounds like you're referring to downloads for products here. If you go into your Network Dashboard, and visit:

    WPMU DEV -> Support -> System Info

    Inside of the PHP tab & the WordPress tab, how much memory is allocated to PHP, and to WordPress itself (the value for PHP being memory_limit, and WP_MEMORY_LIMIT for WordPress)? Should be at least 256 MB, but it's possible that more could be required.

    Also, do you have any caching plugins active on this network? And did you make a change to your network around the time this started to happen? (e.g. installing a new plugin)

    Please advise,
    Michael

  • Sandor

    Hi Michael,

    Sorry for the late reply - after some testing I found that it was the SmartCrawl plugin that is conflicting. I deactivate it and downloads work - activate it and no.

    Since they are both wpmudev plugins I was kind of surprised - I'm not sure what the seo options have to do with downloads, but what do I know..

    Let me know what I can do to help you figure this, I've enabled support access in the admin area in case you need it.

    Thanks,
    -Sandor

  • Panos

    Hello Sandor ,

    Thank you for granting us access :slight_smile:

    I took the liberty and logged in your site to try replicate this issue but with no luck.

    Let me list what steps I followed:
    1. Created a new user (wpmutest)
    2. Created a new subsite (wpmutest - I used all my imagination for naming :slight_smile: )
    3. In the subsite I added a new digital product "Downloadable One"
    4. Made an order (with manual payment) and after setting order to paid I could download normally.
    5. Network activated SmartCrawl plugin
    6. Created another digital product "Downloadable Two"
    7. Did another order and again could download with no issues

    I have now deactivated SmartCrawl plugin but I have left the user, sub site and products so you can also do some tests.

    Please let me know if I am missing something here :slight_smile:

    Looking forward to your reply!

    Kind regards,
    Panos

  • Sandor

    Um, er,

    I used the account/products you created and my testing was totally the opposite of yours?

    First I changed the price to 0.00 for Download 1 to make it faster to check out.
    Selected the file and went through the purchase process.
    The file (jpg) that downloaded could not be opened by my computer, I tried a few times.
    I changed the file to a client's audio file - the download seemed to proceed but again the file was not recognized by my computer's audio player.

    I verified the original files in both cases worked on my machine.
    In fact the audio file can be play from within the wordpress media library, so the version on the server is fine.

    Now I turned on Smartcrawl.
    Without leaving the page that had previously downloaded the corrupted file - I hit download again, this time it stopped at 1k as it was doing for me previously when the downloads failed.

    Now I turned off Smartcrawl.
    Again, without reloading the page or anything - the download link now seems to download the entire file (but it's still not recognizable).

    I'm not sure how we could have such different results. I'm using a standard windows/chrome build for all the testing...

    Let me know how to proceed?

    Thanks!
    -Sandor

  • Panos

    Hi Sandor,

    I tested some times again with SmartCrawl active and deactivated, and in both situations I noticed similar behaviour, the jpeg would download (and open) normally, but the mp3 file would fail to download even with smartcrawl inactive. That could be possibly related to server config but I can't be sure.

    I will do some tests in my installation too and get back to you regarding this issue.

    Kind regards,
    Panos

  • Panos

    Hi Sandor,

    I couldn't replicate this issue in any of my test installations, so it might be related to server config.

    Could you please try purchasing products Downloadable Two (a small mp3 file) and Downloadable Three (a pdf file) without activating SmartCrawl? When I tried this the files could not be recognized.

    To further investigate this issue I would need your ftp credentials. You can send that privately through our contact form: https://premium.wpmudev.org/contact/

    Select "I have a different question?" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:Subject: "Attn: Panos Lyrakis"
    - WordPress admin username
    - WordPress admin password
    - login url
    - FTP credentials (host/username/password)
    - link back to this thread for reference: https://premium.wpmudev.org/forums/topic/the-downloads-are-failing-and-im-seeing-this-error
    - any other relevant urls

    Kind regards,
    Panos

  • Panos

    Hello Sandor,

    Apologies for the delay here!

    I tried making a purchase to do some further testing but I get a js error coming from file flexpress/js/flexpress.js saying $ is undefined

    You can try adding:
    var $ = jQuery.noConflict();

    at the very begging of the js file and see if this fixes this error.

    I believe that this error is blocking products to be added to cart.

    I'll be looking on the download issue immediately after this is fixed. Please let me know if you need assistance on this :slight_smile:

    Looking forward to your reply!

    Thanks!
    Panos

  • Panos

    Hi Sandor,

    Re noConflict - I've added that. I wonder why it became an issue now?

    I can still see the js error, here's what I get in FF :

    In chrome I get a similar error message.

    I see that you are enqueuing the script later than jQuery, so it can't be it. Perhaps some conflict or a typo? You can try printing the following at your console:

    console.log($); // If is undefined there might be conflict

    and

    console.log($ === jQuery); // If prints 0 or false then again it's a sign of conflict

    You can also delete your script and check with some simpler js code.

    The firewall is a bit strict, you might need to whitelist your IP, let me know if that's the case.

    I think it was my fault trying to connect through FileZilla's quick connect. Managed to connect selecting "Only use plain FTP" at Encrypion.

    So I will be making some changes in order to try figure out what is causing this. I wish I could do this in one of my installations, but unfortunately I don't have this issue... I'll keep you updated when I find something.

    Thanks!
    Panos

  • Sandor

    Panos,

    I have a new issue and I don't know if it's the result of testing or I should be making a new ticket.

    On one of my live client's sites ; When selecting an item with the 'add to cart' button it takes you to the cart but the cart says it is empty. This has never happened before...
    If this is not the result of the testing you are doing, let me know so I can open a new ticket?

    Again, this is affecting live shops.. Thanks!
    -Sandor

  • Panos

    Hello Sandor,

    I have been making changes but I didn't think they would be affecting the rest functionality. It's not impossible though...

    Anyhow I have restored original files since I couldn't figure out what is causing this.

    I have found a similar thread in which the proposed solution worked :
    https://premium.wpmudev.org/forums/topic/marketpress-pdf-downloads-corrupt-on-live-site-but-not-on-dev-site#post-764492

    I hope this helps you too!

    Looking forward to your reply!

    Kind regards,
    Panos

  • Sandor

    Great,

    I turned off zlib compressions which was enabled globally and the downloads are not corrupted!
    Also - the issue on the other site seems to have gone away, so whatever it was all clear.

    HOWEVER

    I'm back to the original problem... When I enabled smartcrawl - the downloads failed again.
    I used download 2 in your test site, I set it to 0.00 and it was working fine, I enabled the plugin and the same link now failed (I didn't go through the purchase process again, the same link on the same page now failed).

    Thanks for all your help so far!
    -Sandor

  • Panos

    Hi Sandor,

    Glad the setting zlib off worked :slight_smile:

    Regarding the SmartCrawl issue, I noticed that you had misplaced the

    define('WP_MEMORY_LIMIT', '512M');

    part in wo-config.php file. It was placed at the very bottom of the file but it needed to be placed somewhere before line that contains the following:
    "/* That's all, stop editing! Happy blogging. */"

    After changing it's position it seems to be downloading properly with SmartCrawl active.

    Please do some tests and let me know if this has been fixed on your side too :slight_smile:

    Thanks!
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.