Archived topic
PHP8 Fatal error
7 replies · Started by Yaotian on September 28, 2021
Hello,
When I use php7.4, I import the woocommerce website from the site library, everything works fine on the website,
When I use php8, I import the woocommerce website from the site library, and always report the following error:
Fatal error: Uncaught Error: Call to undefined function putenv() in /www/www.mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:37 Stack trace: #0 /www/www.mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php(49): WC_Regenerate_Images_Request->__construct() #1
/www/www.mysite.com/wp-includes/class-wp-hook.php(303): WC_Regenerate_Images::init() #2
/www/www.mysite.com/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #3
/www/www.mysite.com/wp-includes/plugin.php(470): WP_Hook->do_action() #4
/www/www.mysite.com/wp-settings.php(578): do_action() #5
/www/www.mysite.com/wp-config.php(96): require_once('...') #6
/www/www.mysite.com/wp-load.php(50): require_once('...') #7
/www/www.mysite.com/wp-blog-header.php(13): require_once('...') #8
/www/www.mysite.com/index.php(17): require('...') #9 {main} thrown in /www/www.mysite.com/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php on line 37
There has been a critical error on this website.
Learn more about troubleshooting WordPress.
For other reasons, I need to use PHP8 but cannot use PHP7. What should I do?
Hi there,
which version of PHP 8 are you using ?
8.0
The errors are all related to a Woocommerce function call, according to their docs it is compatible with the stable releases of PHP 8 ( currently 8.0.7 ) - you may need to check with Woo support on this.
In the meantime, what happens if you install the site on PHP 7.4 and then upgrade to 8 ?
Thanks, I didn't try to upgrade from 7.4 to 8.0, I was using 8.0 directly
Give that a try - if the error arises again then its something that Woo will need to address.
Ok, David, thanks for your help!
You're welcome