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.
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
Related
This question already has answers here:
Unknown column 'wp_' in 'field list' when running WordPress on PHP 8.1
(3 answers)
Closed last year.
Please I need help its my firs time to setup and I can't install wordpress in my localhost server IIS I'm using latest PHP, MySQL and IIS.
Here is my Debug LOG:
[15-Jan-2022 02:53:10 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Table 'cswebsite.wp_options' doesn't exist in C:\inetpub\wwwroot\cswebsite\wp-includes\wp-db.php:2056
Stack trace:
#0 C:\inetpub\wwwroot\cswebsite\wp-includes\wp-db.php(2056): mysqli_query(Object(mysqli), 'SELECT option_v...')
#1 C:\inetpub\wwwroot\cswebsite\wp-includes\wp-db.php(1945): wpdb->_do_query('SELECT option_v...')
#2 C:\inetpub\wwwroot\cswebsite\wp-includes\wp-db.php(2581): wpdb->query('SELECT option_v...')
#3 C:\inetpub\wwwroot\cswebsite\wp-includes\functions.php(1734): wpdb->get_var('SELECT option_v...')
#4 C:\inetpub\wwwroot\cswebsite\wp-includes\load.php(752): is_blog_installed()
#5 C:\inetpub\wwwroot\cswebsite\wp-settings.php(159): wp_not_installed()
#6 C:\inetpub\wwwroot\cswebsite\wp-config.php(97): require_once('C:\inetpub\wwwr...')
#7 C:\inetpub\wwwroot\cswebsite\wp-load.php(50): require_once('C:\inetpub\wwwr...')
#8 C:\inetpub\wwwroot\cswebsite\wp-admin\install.php(36): require_once('C:\inetpub\wwwr...')
#9 {main}
thrown in C:\inetpub\wwwroot\cswebsite\wp-includes\wp-db.php on line 2056
I had the same issue trying to make a fresh local install of WP with no previous versions installed.
I saw a couple of posts (example) suggesting it's a PHP version problem with WP5.8.x, and reverting to PHP8.0 works. And guess what, it did.
(I was using homebrew, and 'brew install php#8.0' doesn't create the symlinks you need to do a 'brew link php#8.0' afterwards. Also, it put libphp.so in a different place (why, Lord, why?) so you need to change your httpd.conf as well. Oh, and you probably need to do 'brew remove php' before you start the downgrade)
Hope this works for you...
Kindly assist me to resolve this error after installing my WordPress on a live server and the local one gave me this error and warning i couldn't get the site on the local server. I'm using Laragon for the local server. Please assist. The error message I got is below.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_add_default_theme_supports' not found or invalid function name in C:\laragon\www\rsbenterprise\wp-includes\class-wp-hook.php on line 307
Fatal error: Uncaught Error: Call to undefined function wp_json_file_decode()
in C:\laragon\www\rsbenterprise\wp-includes\blocks.php:238
Stack trace:
#0 C:\laragon\www\rsbenterprise\wp-includes\blocks\archives.php(119): register_block_type_from_metadata('C:\\laragon\\www\\...', Array)
#1 C:\laragon\www\rsbenterprise\wp-includes\class-wp-hook.php(307): register_block_core_archives('')
#2 C:\laragon\www\rsbenterprise\wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#3 C:\laragon\www\rsbenterprise\wp-includes\plugin.php(470): WP_Hook->do_action(Array)
#4 C:\laragon\www\rsbenterprise\wp-settings.php(578): do_action('init')
#5 C:\laragon\www\rsbenterprise\wp-config.php(90): require_once('C:\\laragon\\www\\...')
#6 C:\laragon\www\rsbenterprise\wp-load.php(50): require_once('C:\\laragon\\www\\...')
#7 C:\laragon\www\rsbenterprise\wp-admin\admin.php(34): require_once('C:\\laragon\\www\\...')
#8 C:\laragon\www\rsbenterprise\wp-admin\index.php(10): require_once('C:\\laragon\\www\\...')
#9 {main} thrown in C:\laragon\www\rsbenterprise\wp-includes\blocks.php on line 238
There has been a critical error on this website. Please check your site admin email inbox for instructions.
The wp_json_file_decode() utility function first appeared in version 5.9 of WordPress.
Your error message points to an incomplete or somehow corrupted update from a previous WordPress version to 5.9.
A good approach to fixing this problem: go to a working version of your site, then use a migration plugin to capture the working site and migrate it to a new server.
When I try to install any theme to wordpress this error shows up, what should I do?
Fatal error: Uncaught ArgumentCountError: array_merge() does not
accept unknown named parameters in
D:\xampp\htdocs\wordpress\wp-includes\widgets.php:1261 Stack trace: #0
D:\xampp\htdocs\wordpress\wp-includes\widgets.php(1261):
array_merge(wp_inactive_widgets: Array, sidebar-1: Array, sidebar-2:
Array, sidebar-3: Array) #1
D:\xampp\htdocs\wordpress\wp-includes\widgets.php(1216):
retrieve_widgets(true) #2
D:\xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(289):
_wp_sidebars_changed('Twenty Twenty') #3 D:\xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(311):
WP_Hook->apply_filters(NULL, Array) #4
D:\xampp\htdocs\wordpress\wp-includes\plugin.php(478):
WP_Hook->do_action(Array) #5
D:\xampp\htdocs\wordpress\wp-includes\theme.php(2974):
do_action('after_switch_th...', 'Twenty Twenty', Object(WP_Theme)) #6
D:\xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(287):
check_theme_switched('') #7
D:\xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(311):
WP_Hook->apply_filters(NULL, Array) #8
D:\xampp\htdocs\wordpress\wp-includes\plugin.php(478):
WP_Hook->do_action(Array) #9
D:\xampp\htdocs\wordpress\wp-settings.php(540): do_action('init') #10
D:\xampp\htdocs\wordpress\wp-config.php(90):
require_once('D:\xampp\htdocs...') #11
D:\xampp\htdocs\wordpress\wp-load.php(37):
require_once('D:\xampp\htdocs...') #12
D:\xampp\htdocs\wordpress\wp-blog-header.php(13):
require_once('D:\xampp\htdocs...') #13
D:\xampp\htdocs\wordpress\index.php(17):
require('D:\xampp\htdocs...') #14 {main} thrown in
D:\xampp\htdocs\wordpress\wp-includes\widgets.php on line 1261
This is a poorly asked question as you have provided no context around the error message presented. Given the error appears to be coming from within WordPress code, I am guessing you do not have direct control over the underlying function call that is triggering this error. My best guess is that you are running an old version of WordPress on a system with PHP 8.0+ deployed (see explanation below). Either upgrade WordPress or downgrade to PHP 7.4.
For anybody else that comes this way in search of an answer to why this error is thrown in their code, the error is related to a new feature of PHP 8.0 called 'Named Parameters'. In the case of array_merge, the error can be thrown if you invoke it in the following manner, using a string-keyed array:
call_user_func_array('array_merge', [
'key1'=>['abc', 'def'],
'key2'=>['ghi', 'jkl']
]);
-> Error
This is because call_user_func_array will interpret the top-level array keys as parameter names to be passed into the array_merge, and these keys will not match the function arguments.
The solution here is to use array_values to strip away the keys first:
call_user_func_array('array_merge', array_values([
'key1'=>['abc', 'def'],
'key2'=>['ghi', 'jkl']
]));
-> ['abc','def','ghi','jkl']
I tried composer update, composer self-update everything
but finally this one fixed my issue:
Change:
$choices = call_user_func_array( 'array_merge', $choices );
to:
$choices = call_user_func_array( 'array_merge', array_values($choices) );
This fixed it for me
The following worked for me when I ran into these issues on my Bluehost WordPress site:
Downgrade PHP from 8.0 to 7.4 using the MultiPHP Manager
Upgrade WordPress from 5.3 to 5.9 via wp-admin
Upgrade PHP from 7.4 to 8.1 using the MultiPHP Manager
Had same issue after upgrading to php 8.x
Fixed with:
sudo composer self-update
Recommendation: just install the latest version of the composer in Linux and define it globally and run it on the project directory and the issue is resolved.
Composer 1.10.1 ----> to ------> Composer version 2.3.4
Hint: if same then revoke the composer.lock and vendor folder and run it again.
I am working on a application that uploads and shows file from google drive to a website and for that i am using google drive api in php and i have followed the quickstart.php when i enter the verification code it shows me some error
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:67
Stack trace:
#0 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(67): count()
#1 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(141): GuzzleHttp\Handler\CurlFactory->release()
#2 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError()
#3 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish()
#4 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#5 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#6 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(72): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#7 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#8 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(68): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#9 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(57): GuzzleHttp\RedirectMiddleware->__invoke()
#10 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#11 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(268): GuzzleHttp\HandlerStack->__invoke()
#12 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(96): GuzzleHttp\Client->transfer()
#13 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(104): GuzzleHttp\Client->sendAsync()
#14 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\HttpHandler\Guzzle6HttpHandler.php(34): GuzzleHttp\Client->send()
#15 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\OAuth2.php(492): Google\Auth\HttpHandle#16 D:\xampp\htdocs\google-drive-api\vendor\google\apiclient\src\Google\Client.php(184): Google\Auth\OAuth2->fetchAuthToken()
#17 D:\xampp\htdocs\google-drive-api\google-drive.php(52): Google_Client->fetchAccessTokenWithAuthCode()
#18 D:\xampp\htdocs\google-drive-api\google-drive.php(70): getClient()
#19 {main}
thrown in D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67
Must be a problem with the php version . I was on php8 and was facing the same issue but when once I change to php7.3 the error became warning. Since the major changes in php7.4 and greater that might be causing the error of count()
As of PHP 7.2, the count() function will throw a warning when a value passed into it is not countable. Later on, this was made to throw a fatal error in PHP 8.0
See https://www.php.net/manual/en/function.count.php
Changelog
Version
Description
PHP 7.2
count() will now yield a warning on invalid countable types passed to the value parameter.
Since PHP 8.0 is a relatively new (and major) release that just came out 4 months ago in November, there is a good chance that a very large portion of PHP libraries aren't up to date yet. (I'm still developing in PHP 7.4 because of this.)
Assuming you're using the google/apiclient package, you should be good to go now as it seems to have been updated to support PHP 8.0 on Jan 19th in v2.9.0 (almost a month after you asked this question).
Edit: This is all based on the assumption you're running PHP 8.0, as this is the only version of PHP that throws a fatal error when passing a non countable variable into count().
After upgrading php from 5.2 to 7.2 , while checking out on woocomeerce getting internal server error, when i check the error log in woocommerce it gives the following.
CRITICAL Uncaught ArgumentCountError: Too few arguments to function iwc_display_payment_method_email_order(), 1 passed in /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-content/themes/lensa/functions.php:133
Stack trace:
#0 /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-includes/class-wp-hook.php(288): iwc_display_payment_method_email_order(Object(WC_Order))
#1 /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#2 /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-content/themes/lensa/woocommerce/emails/email-order-details.php(89): do_action('woocommerce_ema...', Object(WC_Order), true, false, Object(WC_Email_New_Order))
#4 /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-content/plugins/woocomm in /home/content/n3pnexwpnas04_data01/18/41356818/html/wp-content/themes/lensa/functions.php on line 133
You can't easily update your Wordpress in such a way. You have to update your Software and all of the dependencies and make them PHP 7.2 compatible. So before your switch to the newest version update your Wordpress and all Plugins.
Then you can switch your PHP-Version and try to fix all other problems. I think in your case with such a big step forward. You should install a new Wordpress and try to migrate all the plugins step by step and fix the problems.