• Resolved chriscarman

    (@chriscarman)


    Hello! I have several custom PHP scripts that run via cron and they use the wp-load.php file via require_once. I noticed a few days ago that they stopped working, so when I tried to run one of them from the command line, it generated HTML that displayed the “There has been a critical error on this website” message. I turned on debugging, the debug.log shows this whenever I run any script that requires wp-load.php:

    [23-Feb-2024 02:22:02 UTC] PHP Warning: class_implements(): Class Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine does not exist and could not be loaded in /home/[*username*]/public_html/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AbstractInterfaceServiceProvider.php on line 34
    [23-Feb-2024 02:22:02 UTC] PHP Parse error: syntax error, unexpected ‘LegacyProxy’ (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /home/[*username*]/public_html/wp-content/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php on line 48

    I disabled the WooCommerce plugin and my custom scripts ran fine. I re-enabled WooCommerce and the scripts gave the same “critical error” message. I’m using WooCommerce 8.6.1, WordPress 6.4.3 and PHP 7.4. Thanks in advance!

    • This topic was modified 2 years, 3 months ago by chriscarman.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Shameem – a11n

    (@shameemreza)

    Hi @chriscarman,

    The error logs you’ve shared indicates that the class Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine is not found. This could be due to several reasons such as missing files, incorrect file permissions, or a conflict with another plugin or theme.

    Here are a few steps you can take to resolve this issue:

    1. You mentioned that you’re using PHP 7.4. While this should be compatible, updating to a newer version of PHP (like 8.1.27) might resolve the issue.
    2. It’s possible that some WooCommerce files are corrupted or missing. Deactivate and delete the WooCommerce plugin, then reinstall it.
    3. Ensure that the file permissions for your WordPress installation are correct.

    In the meantime, you can run a conflict test to help you identify the cause of the issue. More info: https://woo.com/document/how-to-test-for-conflicts/

    Let us know how that goes for you.

    Thread Starter chriscarman

    (@chriscarman)

    I’m still having this issue on both of my websites that use the WooCommerce plugin. I did the following on my lower-traffic site and still encountered the same fatal error each time

    1. Verified that my site is running PHP 8.2
    2. Deleted the woocommerce plugin folder and installed the latest version from ww.wp.xz.cn
    3. Disabled every plugin so that WooCommerce was the only active plugin

    The only time I could get wp-load.php to work is when WooCommerce is deactivated. When it’s active, I still get this error:

    PHP Parse error: syntax error, unexpected ‘LegacyProxy’ (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /home/[username]/public_html/wp-content/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php on line 48

    Line 48 of TransientFilesEngine.php is:

    private LegacyProxy $legacy_proxy;

    This is the only file I can find in the WooCommerce source code that uses the string LegacyProxy in the private variable declaration. Other files use:

    private $proxy;

    but even when I remove LegacyProxy from line 48 in TransientFilesEngine.php, it still gives this parse error:

    PHP Warning: class_implements(): Class Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine does not exist and could not be loaded in /home/[*username*]/public_html/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AbstractInterfaceServiceProvider.php on line 34

    At the top of AbstractInterfaceServiceProvider.php, I tried adding this line:

    use Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine;
    

    Same error. I also can’t use WP CLI to add a user, because I get the same fatal error. Anything you can do to help would be appreciated!

    Thread Starter chriscarman

    (@chriscarman)

    For anyone who stumbles across this thread in the future, the issue was that I didn’t realize that PHP cli was using 7.3.33. When I ran my custom script by calling php74, there was no conflict with the WooCommerce plugin. Sorry for any confusion this might have caused!

    Plugin Support Shameem – a11n

    (@shameemreza)

    Hi @chriscarman,

    I’m glad you were able to find a solution to your inquiry here and thanks for sharing it with the community too! 🙂

    Should you have further inquiries, kindly create a new topic here.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WooCommerce breaking script using wp-load.php’ is closed to new replies.