Support » Plugin: WooCommerce » Critical error on PHP 8.0

  • Resolved 18TommyBoy

    (@18tommyboy)


    I have too critical error with Woocommerce, and only can search on internet but no help…

    Full clean fresh install. Webserver is OpenLiteSpeed, php memory limit 2048 (own vps). Theme Twenty Twenty-two. First plugin to install: Woocommerce and:

    There has been a critical error on this website. Please check your site admin email inbox for instructions.

    Learn more about troubleshooting WordPress.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Joseph B. (woo-hc)

    (@tamirat22)

    Hello @18tommyboy!

    Thanks for reaching out!

    I have too critical error with Woocommerce, and only can search on internet but no help…There has been a critical error on this website. Please check your site admin email inbox for instructions.

    Could you please give us a little more insight into the issue?

    Please check for any fatal errors under your page here: WooCommerce → Status → Logs and look for any recent Fatal Errors listed there.

    Could you also please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.  Once you’ve done that, paste it here in your response.

    We will be waiting for your reply!

    Thread Starter 18TommyBoy

    (@18tommyboy)

    So, the first the logs:
    `2022-06-25T18:36:12+00:00 CRITICAL Uncaught Error: Call to undefined function putenv() in /www/wwwroot/mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:37
    Stack trace:
    #0 /www/wwwroot/mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php(49): WC_Regenerate_Images_Request->__construct()
    #1 /www/wwwroot/mysite.com/wp-includes/class-wp-hook.php(307): WC_Regenerate_Images::init()
    #2 /www/wwwroot/mysite.com/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #3 /www/wwwroot/mysite.com/wp-includes/plugin.php(476): WP_Hook->do_action()
    #4 /www/wwwroot/mysite.com/wp-settings.php(598): do_action()
    #5 /www/wwwroot/mysite.com/wp-config.php(96): require_once(‘…’)
    #6 /www/wwwroot/mysite.com/wp-load.php(50): require_once(‘…’)
    #7 /www/wwwroot/mysite.com/wp-blog-header.php(13): require_once(‘…’)
    #8 /www/wwwroot/mysite.com/index.php(17): require(‘…’)
    #9 {main}
    thrown in /www/wwwroot/mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php on line 37

    2022-06-25T18:36:23+00:00 CRITICAL Uncaught Error: Call to undefined function putenv() in /www/wwwroot/mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:37
    Stack trace:…..

    Thread Starter 18TommyBoy

    (@18tommyboy)

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://mysite.com
    Site address (URL): https://mysite.com
    WC Version: 6.6.1
    REST API Version: ✔ 6.6.1
    WC Blocks Version: ✔ 7.6.2
    Action Scheduler Version: ✔ 3.4.0
    Log Directory Writable: ✔
    WP Version: 6.0
    WP Multisite: –
    WP Memory Limit: 768 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: ✔
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: 7.4.30
    PHP Post Max Size: 12 MB
    PHP Time Limit: 120
    PHP Max Input Vars: 5000
    cURL Version: 7.64.0
    OpenSSL/1.1.1n
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.5.12-MariaDB-log
    Max Upload Size: 12 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 6.6.1
    WC Database Prefix: ewp_
    Total Database Size: 3.40MB
    Database Data Size: 1.96MB
    Database Index Size: 1.44MB
    ewp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    ewp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    ewp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    ewp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    ewp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    ewp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    ewp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_options: Data: 1.03MB + Index: 0.03MB + Engine InnoDB
    ewp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_posts: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    ewp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    ewp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
    ewp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    ewp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    ewp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    ewp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    ewp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    ewp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    ewp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    ewp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 1
    page: 7
    post: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (4) ###
    
    Redis Object Cache: by Till Krüss – 2.0.26
    WooCommerce: by Automattic – 6.6.1
    WordPress Hosting Benchmark tool: by Anton Aleksandrov – 1.3.1
    WP Performance Tester: by <a href="https://reviewsignal.com">Kevin Ohashi</a> – 2.0.0
    
    ### Inactive Plugins (1) ###
    
    PHP/MySQL CPU performance statistics: by Mywebtonet.com / Webhosting.dk – 1.2.1
    
    ### Dropin Plugins (1) ###
    
    object-cache.php: Redis Object Cache Drop-In
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    Enforce Approved Product Download Directories: ✔
    
    ### WC Pages ###
    
    Shop base: #9 - /index.php/shop/
    Cart: #10 - /index.php/cart/
    Checkout: #11 - /index.php/checkout/
    My account: #12 - /index.php/my-account/
    Terms and conditions: ❌ Page not set
    
    ### Theme ###
    
    Name: Twenty Twenty-Two
    Version: 1.2
    Author URL: https://wordpress.org/
    Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: –
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    coupons
    customer-effort-score-tracks
    experimental-products-task
    experimental-import-products-task
    experimental-fashion-sample-products
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    wc-pay-promotion
    wc-pay-welcome-page
    wc-pay-subscriptions-page
    
    Disabled Features: minified-js
    settings
    
    Daily Cron: ✔ Next scheduled: 2022-06-27 18:36:03 +00:00
    Options: ✔
    Notes: 40
    Onboarding: -
    
    ### Action Scheduler ###
    
    Complete: 3
    Oldest: 2022-06-25 18:39:33 +0000
    Newest: 2022-06-26 20:58:55 +0000
    
    Pending: 1
    Oldest: 2022-06-27 20:58:55 +0000
    Newest: 2022-06-27 20:58:55 +0000
    
    ### Status report information ###
    
    Generated at: 2022-06-26 21:04:06 +00:00
    
    Plugin Support Kaushik S. a11n

    (@kaushiksomaiya)

    Hi @18tommyboy!

    Thanks for sharing the fatal error logs and the system status report.

    I believe this might have something to do with server configuration.

    I found a recent report on the WooCommerce Github repository – https://github.com/woocommerce/woocommerce/issues/31942 which looks similar to your issue.

    Could you try the workaround (creating wp-content/mu-plugins/putenv.php file) mentioned there?

    Let us know how that goes! 🙂

    Thread Starter 18TommyBoy

    (@18tommyboy)

    Okay, when good understand I must put this:

    <?php
    
    if ( ! function_exists( 'putenv' ) ) {
    	/**
    	 * No-op placeholder for cases where putenv() is disabled via an .ini file.
    	 *
    	 * @param string $assignment
    	 */
    	function putenv( string $assignment ) {}
    }

    because Woocommerce developers using this blacklisted function and this is not automated…?

    Thread Starter 18TommyBoy

    (@18tommyboy)

    And the question is, it’s safe to deactivate webshops this function?

    Plugin Support Rynald0s.a11n

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @18tommyboy

    Yes, you need to create a file called “putenv.php” inside the wp-content/mu-plugins/ folder, with the code you see there. You are technically not disabling anything as putenv() is already disabled. This code should just bypass the issue you are having. Have you reached out to your host yet, with this error?

    Cheers!

    Thread Starter 18TommyBoy

    (@18tommyboy)

    Like I say, I am the host. Deleted the disabled putenv and start working.
    In future is safe this putenv disable with mu-plugins? For what is this for?

    Plugin Support Rynald0s.a11n

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @18tommyboy.

    In future is safe this putenv disable with mu-plugins? For what is this for?

    Yes. In cases where putenv() is disabled in PHP.ini, it looks to see if putenv() does not exist, and if so to set it.

    Cheers!

    Thread Starter 18TommyBoy

    (@18tommyboy)

    Okay, that works and tested.
    Is any difference when mu-plugins folder use, versus I creating yet plugin and inserted this code near others (and work too).

    Is any difference on speed or anything?

    Plugin Support Rynald0s.a11n

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @18tommyboy

    In terms of MU, it gets automatically installed across all sites within the installation. The difference between that and a plugin is that it won’t show up in the default plugins, and thus cannot be deleted (or else things will break again).

    I suppose you can add it as a normal plugin, but by default, it will contain additional header information etc which also by default, will add some extra weight to your site which I don’t think is necessary.

    I would personally just keep it where and how it is.

    Cheers!

    Plugin Support Joseph B. (woo-hc)

    (@tamirat22)

    Hello @18tommyboy!

    Hope you found the suggestions above helpful!

    I’m going to mark this as resolved now.

    If you have any further questions, I recommend creating a new thread.

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.