• Resolved chrisce

    (@chrisce)


    Hello,

    I would like to start with saying great plugin! But for some reason it seems that the plugin turns on PHP output buffering , not making it possible to output php echo as the script runs, instead it saves everything in memory and then prints everything at the same time when the script is done. I my case, I’m importing products from a feed, with a response after each product import – It seems that this plugins turns on PHP buffering.

    I have come to this conslusion by disabling and uninstalling the plugin, then its works fine. When installing and enabling the plugin, I can’t see any output more instead it outputs all the echos in the end when the script is done running and not while it’s running.

    Is it possible to fix that php buffering is turned to off or not override this setting?

    Best regards,
    Chris

    • This topic was modified 9 months ago by chrisce.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support qtwrk

    (@qtwrk)

    the output buffer is the core function of our plugin , if you don’t buffer it , the page optm will not be possible as it sends to brwoser directly as it outputs and obvious you can not use PHP to modify the HTML source code that sends to browser already.

    if you know what is the request URI of your importing , I can help you to disable our plugin on that specific URL.

    Thread Starter chrisce

    (@chrisce)

    Hi,

    The structure for my website is as follows:

    public_html (wp installation is in public_html)
    - .... (wordpress installation files...)
    -- ceeglo-engine
    ----import
    ------ run.sh -> calling init.php
    ------ init.php
    ------ logs (folder)


    init.php calls wp-load, it seems like as soon as wp-load is included in my file, the buffering is on.
    Init.php file start like this:

    // Run init for import functions

    if (!defined('ABSPATH')) {

    ? ? define('ABSPATH', '/home/account/domains/DOMAIN/public_html/');

    }

    require_once ABSPATH . '/wp-load.php';

    require_once ABSPATH . '/wp-includes/wp-db.php';

    require_once ABSPATH . '/wp-includes/pluggable.php';

    Best regards,
    Chris

    Plugin Support qtwrk

    (@qtwrk)

    I’d suggest this

    add define('LSCWP_V', '1'); before you load wp-load.php , once this constant is defined before our plugin does, our plugin will exit immediately before actually initialize

    but you may need to check if there is any purge problem after this , like if you import something that requires cache purge

    Thread Starter chrisce

    (@chrisce)

    Hi again,

    Lovely, I will try it out. I agree with you regarding the cache problem, I’m inserting massive amount of products, Is there a function I can call in order to purge cache after the script is done running?

    Best regards,
    Chris

    Plugin Support qtwrk

    (@qtwrk)

    just a quick thinking

    create another , separated file , with code like

    <?php
    require( './wp-load.php' );
    if ( defined('LSCWP_V')) {
    do_action( 'litespeed_purge_all' );
    }

    name it like my_import_purge.php or something secret , you can add certain authentication to prevent unauthorized purge

    then on your script , after it finished inport , send a request to it , like wp_remote_get( 'https://your_domain.com/my_import_purge.php' ); to purge it.

    Thread Starter chrisce

    (@chrisce)

    Hi,

    Sounds great, I will try it out. Thanks!

    Thread Starter chrisce

    (@chrisce)

    Hi again,

    The solution above seems to have fixed the most of the problems. However, I’m seeing that using this plugin activated while importing products seems to slow down the whole process, going from 120 minutes when plugin is inactivated to 450 minutes when plugin is activated, to import all products.

    Could it possibly be some caching settings that I should turn off, that can slow down the process?

    Best regards,
    Chris

    Plugin Support qtwrk

    (@qtwrk)

    if you have enabled object cache, try disable it

    logically , with that define LSCWP_V , the plugin should not even be loaded on your importing , but object cache is the only thing that could “bypass” this disabling

    Thread Starter chrisce

    (@chrisce)

    Great thanks, I will try it out.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Turn off php output buffering’ is closed to new replies.