I have an issue with using new PHP 8.1 on WordPress 5.7.2. Everything work just fine, until turn on WooCommerce 5.3.0. Then whole site fall down.
Here is error message what I’m getting:
Fatal error: Uncaught Error: Call to undefined function putenv() in
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:37
Stack trace: #0
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php(49):
WC_Regenerate_Images_Request->__construct() #1
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-includes/class-wp-hook.php(292):
WC_Regenerate_Images::init(”) #2
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-includes/class-wp-hook.php(316):
WP_Hook->apply_filters(NULL, Array) #3
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-includes/plugin.php(484):
WP_Hook->do_action(Array) #4
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-settings.php(560):
do_action(‘init’) #5
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-config.php(90):
require_once(‘/data/web/virtu…’) #6
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-load.php(37):
require_once(‘/data/web/virtu…’) #7
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-admin/admin.php(34):
require_once(‘/data/web/virtu…’) #8
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-admin/plugins.php(10):
require_once(‘/data/web/virtu…’) #9 {main} thrown in
/data/web/virtuals/2036/virtual/www/domains/e-biowa.cz/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php
on line 37
Please does anyone know, if there is any problem with compatibility? I didn’t find any information about it.
3
Answers
This isn’t a problem with 8.1 over 8.0.
PHP has a function blacklist.
Remove
putenv
from the blacklist. This worked for me when I received this error using PHP 8.0.WordPress is not ready yet for PHP 8.1. If you install on 8.1 you can show dozens of errors about deprecated methods like ltrim() or count, even if install WordPress 5.8.2. You can fix most of the issues in this reference
but its not worth that. My advice is you wait for the compatible version of WordPress.
Remove or change this lines from php ini or config file:
//either put colon or remove this whole line
;disable_functions = passthru,exec,putenv,system,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv