Argument PDOStatement Errors
Problem
When performing MySQL®-intensive actions, you see one of the following errors:
TypeError: Argument 1 passed to Illuminate\Database\Connection::prepared() must be an instance of PDOStatement, bool given
or
TypeError: Argument 1 passed to WHMCS\Database\MysqlCompat::setLastStatement() must be an instance of PDOStatement or null, bool
These generally occur during the daily automation cron tasks, when importing TLDs and pricing, or when syncing accounts into WHMCS from a server.
Cause
This may be due to the following causes:
- The Module Log is enabled and the system is logging a large amount of data to the MySQL database.
- The
wait_timeout
andinteractive_timeout
variables in the MySQL server configuration are too low to complete the request.
Solution
Disable the Module Log
We recommend disabling the Module Log unless you are actively troubleshooting a module-related issue. We also recommend using the the default values for the wait_timeout
and interactive_timeout
variables in the MySQL server configuration.
To disable the Module Log:
- Go to Configuration () > System Logs.
- Click Module Log in the left-side menu.
- Click Disable Debug Logging.
Correct the MySQL Server Configuration
To update the wait_timeout
and interactive_timeout
values to use their defaults:
Open your MySQL server’s
/etc/mysql/my.cnf
file.Find the
wait_timeout
andinteractive_timeout
values:[mysqld] wait_timeout=28800 interactive_timeout=28800
Set both values to
28800
if they do not already use this value.For more information, see MySQL’s wait_timeout and interactive_timeout documentation.Save the changes to the file.
Restart your MySQL server by running the following command:
service mysql restart
Last modified: October 29, 2024