I want to solve

I suspect the parameters of Amazon RDS MariaDB in the situation where the AWS environment cannot be displayed due to the following error.
If i have any knowledge about parameters that cannot be used with RDS and parameters that need to be set, would you please let me know?

The version of the DB server is different, but another server running MariaDB 10.5.5 (not an AWS environment)
Then the error does not occur and the site is displayed normally.
The Apache/OS/PHP version of the site that is displayed normally is the same as the AWS environment where the error occurs.

PHP Fatal error: Call to a member function fetchRow () on boolean in /opt/spf/htdocs/ja/usr-data/units/bSlideShow/bSlideShow.php on line 547
    545 if (isset ($this->_ pageu_code)&&is_numeric ($this->_ pageu_code)) {
    546 $result = $this->db->prepare ($sql, $this->_pageu_code);
    547 $firstRow = $result->fetchRow (DB_FETCHMODE_ASSOC);
    548 $firstRow = $this->replaceMultipleData ($firstRow, $this->column_link);
    549 $rtn = $firstRow;
    550 if (is_numeric ($firstRow ['umlt_code'])) {
    551 $rtn ['umlt'] [] = $row = $this->setResult ($firstRow);
    552 while ($row = $result->fetchRow (DB_FETCHMODE_ASSOC)) {
    553 $row = $this->setResult ($row);
    554 $row = $this->replaceMultipleData ($row, $this->column_link);
    555 $rtn ['umlt'] [] = $row;
    560 return $rtn;
PDO database connection test program
<? php
// PDO settings$pdo_dsn ='mysql: host = xxx-xxx-db.xxxxxx.ap-northeast-1.rds.amazonaws.com;dbname = xxx_xxxxx;charset = utf8;';
$pdo_user ='spfdb';
$pdo_pass = '4dGKqE3W';
$pdo_option = array (
        PDO :: ATTR_EMULATE_PREPARES =>false,
// Database connection
try {
        $pdo = new PDO ($pdo_dsn, $pdo_user, $pdo_pass, $pdo_option);
} catch (Exception $e) {
        header ('Content-Type: text/plain;charset = UTF-8', true, 500);
        exit ($e->getMessage ());
?><! DOCTYPE html><html><head><meta charset = "UTF-8"><title>PDO connection test</title></head><body><? php
// SQL issuance
$stmt = $pdo->query ("SELECT @@ version");
while ($row = $stmt->fetch ()) {
        print_r ($row);
What I confirmed

-You can connect to the DB server (AmazonRDS) from the WEB server (AmazonEC2) with the mysql command.
-The PDO database connection test program can be placed and connected to the WEB server.
-PHP/PHP modules and libraries installed on the WEB server are as follows

oniguruma5php.x86_64 6.9.5 + rev1-3.el7.remi @ remi-safe
php.x86_64 5.6.40-23.el7.remi @ remi-php56
php-cli.x86_64 5.6.40-23.el7.remi @ remi-php56
php-common.x86_64 5.6.40-23.el7.remi @ remi-php56
php-devel.x86_64 5.6.40-23.el7.remi @ remi-php56
php-gd.x86_64 5.6.40-23.el7.remi @ remi-php56
php-mbstring.x86_64 5.6.40-23.el7.remi @ remi-php56
php-mcrypt.x86_64 5.6.40-23.el7.remi @ remi-php56
php-mysqlnd.x86_64 5.6.40-23.el7.remi @ remi-php56
php-opcache.x86_64 5.6.40-23.el7.remi @ remi-php56
php-pdo.x86_64 5.6.40-23.el7.remi @ remi-php56
php-pecl-jsonc.x86_64 1.3.10-2.el7.remi.5.6 @ remi-php56
php-pecl-jsonc-devel.x86_64 1.3.10-2.el7.remi.5.6 @ remi-php56
php-pecl-zip.x86_64 1.19.1-1.el7.remi.5.6 @ remi-php56

-Although the version of the DB server is different, the error does not occur on other MariaDB 10.5.5 servers, and the site is displayed normally.
Apache/OS/PHP version is the same as the site with the error

Supplementary information (language/FW/version of tools, etc.)

・ PHP 5.6.4
-Apache 2.4.6
・ MariaDB 10.4.13 (Amazon RDS)
・ Bingo! CMS 1.7.0a
・ CentOS 7.8

  • Answer # 1

    Call to a member function fetchRow () on booleanSo

      546 $result = $this->db->prepare ($sql, $this->_pageu_code);
        547 $firstRow = $result->fetchRow (DB_FETCHMODE_ASSOC);

    Here$resultTofalse falseIt seems that is included.
    See the return value section of PDO :: prepare

    The connection test code is designed to catch exceptions, but I feel that it is not included in production.

    It's difficult to find the cause, so
    If you're debugging yourself (if you don't have any proof that you haven't squeezed the exception elsewhere)

      $this->db->setAttribute (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION);
        try {
          $result = $this->db->prepare ($sql, $this->_pageu_code);
          $firstRow = $result->fetchRow (DB_FETCHMODE_ASSOC);
        } catch (Exception $e) {
           echo $e->getMessage ();
           echo $e->getTraceAsString ();
           die ();

    Check if the exception is thrown as.

Related articles