Support » Plugin: WooCommerce » An Active PHP Session was detected

  • Resolved Shaolin


    Hello, apparently an extension for woocommerce (Viva Wallet) is causing a critical message on Site Health.

    “A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.”

    My dashboard is very slow and CPanel shows it is sucking up half the physical memory. I’ve deativated every plugin and it only happens when this extension is activated. I need this payment gateway as I’m unable to use any other. Even if I disable it in Woo Payment settings it still shows the problem until I deactivate the plugin.

    I have only just installed it today and my site health was fine until now.

    Is there some code I can place somewhere that will make sure the sessions close?

    • This topic was modified 1 year, 8 months ago by Shaolin.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Rynald0s.a11n


    Automattic Happiness Engineer

    Hi @shaolin!

    Does the same happen when all other plugins are disabled and only WooCommerce core left enabled?

    Could you please install the and see if that resolves the issue?


    Thread Starter Shaolin


    Yes, I’m afraid so. I’m using Elementor and Astra and lot of plugins (WP 5.6.2 and Woo 4.9.2) Left only woo, the viva plugin and the default theme – Twenty Twenty.

    I even tried it on the staging site by installing WP 5.7 and Woo 5.10 but still the same problem. The mere activation causes it even if it isn’t actually enabled.

    I’ll go install that jquery plugin and see if that helps. Stay tuned…

    Thread Starter Shaolin


    Hi Rynald

    Unfortunately that didn’t help, the notice is there still. I tried both Default and Legacy settings.

    As mentioned, it is there when it’s just the default theme, woocommerce and viva plugin. Oh and the server is php 7.4

    Edit: I just did a quick downgrade to php 7.3 but problem still showed up.

    • This reply was modified 1 year, 8 months ago by Shaolin.
    • This reply was modified 1 year, 8 months ago by Shaolin.
    • This reply was modified 1 year, 8 months ago by Shaolin. Reason: typos
    • This reply was modified 1 year, 8 months ago by Shaolin.
    Thread Starter Shaolin


    Hi, hope y’all haven’t forgotten about this thread.

    FYI I downloaded an earlier version of the plugin from here in the repository and there is no issue with that one re active PHP session and REST API error. Unfortunately I couldn’t get that plugin to work properly with my version of woocommerce.

    There is also a 3rd party Viva plugin on here, that was vitually identical to the earlier official Viva one. Couldn’t get that to work either, but again no PHP or REST Api warmning for that either, so it’s exclusive to the latest official Viva Wallet plugin I downloaded from Woo’s site.

    So while the latest version of this plugin works it is not good to use because of the php problem (it caused my server resources to be restricted in the last 24hrs since I installed it (physical memory, cpu and I/O) because the site was hitting the limits. Not a lot of traffic on the site fortunately, and that restriction hasn’t happened before so I really need to get this fixed.

    Maybe others are using earlier versions with earlier versions of woo or WP, or maybe they don’t check their site health.

    I’ve searched for code to close the session but none of it worked and I can’t find that code in any of the pugins files.

    Thread Starter Shaolin


    Well, I contacted Viva Wallet Support, because they are supposed to be the developers of the plugin.

    They just kicked it back to WordPress or Woocommerce blaming it on errors in either of those which is baloney, it is the wretched plugin that has the error. Their earlier versions managed to close their php session but I guess they didn’t test too well with recent releases of WP and Woo.

    Does anyone have any code I can input to make the thing close it’s php session? I can’t find the session start function call in any of it’s files, while there is a reference to curl, it doesn’t have any of the strings mentioned in Site Health and code I found on this forum to close the session (for other plugins that triggered the same issue) didn’t work.

    As long it is not closing it’s php session the REST API is prevented from working and I would really like to have that functioning again.

    Somebody must know what code to use to fix this as Viva are clearly not interested in doing so!

    Hello @shaolin,

    I had the exact same issue today. I only just managed to fix it using the following code: `session_start( [
    ‘read_and_close’ => true,
    ] );
    where this code presented:

    I needed to change it in 3 places in “class-wc-vivawallet-helper.php” and “class-wc-vivawallet-credentials.php” then ran the health check again and the issue was gone.

    I’m hoping this helps!

    • This reply was modified 1 year, 8 months ago by axelT_me.
    Thread Starter Shaolin


    Okay, I fixed it thanks to some advice here re other plugins doing this. I had to use String Locator but it found 2 files in Viva with the session_start(); in it and I replaced with session_write_close();

    For anyone else having this issue, the files are:
    wp-content/plugins/viva-wallet-for-woocommerce/includes/class-wc-vivawallet-credentials.php on line 33

    wp-content/plugins/viva-wallet-for-woocommerce/includes/class-wc-vivawallet-helper.php on lines on lines 221 and 493

    The Site Health problem goes away if just the credentials file is changed but I played safe and changed both of them. Oh and the plugin still works ok after the changes. πŸ™‚

    Thread Starter Shaolin


    Ha we cross posted @axelt_me! Glad I’m not the only one affected by this. Hey now people have 2 codes that work yay!

    I’m gonna send Viva the code so they will hopefully code the thing better next time!

    Thanks though, if I hadn’t gone searching again I would have spotted your snippet which would have worked. Previous code I’d found to put in functions file didn’t work.

    • This reply was modified 1 year, 8 months ago by Shaolin.

    Glad to see we both got it working error-free! Have a nice rest of your day!

    Thread Starter Shaolin


    You too mate! πŸ™‚

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘An Active PHP Session was detected’ is closed to new replies.