Jump to content

PHP Fatal error: Call to a member function fetch() on boolean


Recommended Posts

Error on Installation

 

I am Installing in my own Linux Server Prestashop  1.6.1 and after pass all parameter to the web installation the Screen stay blank and nothing happen,

 

I found in the Apache/PHP error log this:

 

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function fetch() on boolean in /var/www/html/test.webstore/classes/db/DbPDO.php on line 369, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP Stack trace:, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP   1. {main}() /var/www/html/test.webstore/install/index.php:0, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP   2. InstallControllerHttp::execute() /var/www/html/test.webstore/install/index.php:31, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP   3. InstallControllerHttpDatabase->validate() /var/www/html/test.webstore/install/classes/controllerHttp.php:157, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP   4. InstallModelDatabase->getBestEngine() /var/www/html/test.webstore/install/controllers/http/database.php:85, referer: http://www.test.webstore/install/index.php

[Thu Aug 13 21:51:20 2015] [error] [client xxx.xxx.xxx.xxx] PHP   5. DbPDOCore->getBestEngine() /var/www/html/test.webstore/install/models/database.php:114, referer: http://www.test.webstore/install/index.php

 

I have experience on Linux apache and php, but with that error I not have idea About.

 

My configuration:

Linux Centos 6.7

MySql 5.7.7

PHP 5.6

 

Thanks for the help !!!!.... 

 

post-1073701-0-65765200-1439521855_thumb.png

Link to comment
Share on other sites

Hi,

It seems call to function is make in file but either file or function not found. Make sure you have uploaded all files web hosting server.

Do you have "fantastico" any other tool on web hosting cPanel/WHM to automatically install Prestashop.This will make installation easy.

PrestaShop Tutorials Videos [How to do Tasks]

https://www.prestashop.com/forums/topic/907438-prestashop-tutorials-videos-how-to-do-tasks/

Edited by Zohaib-fk
Post Updated (see edit history)
Link to comment
Share on other sites

Hi

 

No, any one of those software, I am using my own server dedicated in my site, and I just unzip all the files and change the owner and the mod, on the real production web directory like the other 38 websites in the same server.

 

Is not virtual server is a real Linux/Apache/PHP/MySql server.

 

Please help.

Thanks

Link to comment
Share on other sites

This is the code that is failing. 

        /* MySQL >= 5.6 */
        $sql = 'SHOW ENGINES';
        $result = $this->link->query($sql);
        while ($row = $result->fetch())
            if ($row['Engine'] == 'InnoDB')
            {
                if (in_array($row['Support'], array('DEFAULT', 'YES')))
                    $value = 'InnoDB';
                break;
            }

It performs a query "SHOW ENGINES" and is expecting the result to be an array of engine types (like InnoDB, MyISAM etc...)

 

However your mysql server is returning a boolean instead of an array  What happens if you run the "SHOW ENGINES" query using phpmyadmin or mysqlclient?

  • Like 1
Link to comment
Share on other sites

When I run the "Show Engines", I got this:

 

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
 
What you think ?  I think is an array. and are the same information that lines of code.
 
Actually the error if on this Line:            $row = $result->fetch();
 
 
---------------
        $value = 'InnoDB';
 
        $sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
        $result = $this->link->query($sql);
        if (!$result) {
            $value = 'MyISAM';
        }
        $row = $result->fetch();
        if (!$row || strtolower($row['Value']) != 'yes') {
            $value = 'MyISAM';
        }
 
        /* MySQL >= 5.6 */
        $sql = 'SHOW ENGINES';
        $result = $this->link->query($sql);
        while ($row = $result->fetch()) {
            if ($row['Engine'] == 'InnoDB') {
                if (in_array($row['Support'], array('DEFAULT', 'YES'))) {
                    $value = 'InnoDB';
                }
                break;
            }
   
----------------------
 
 
Edited by oxionstore (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hello

 

I Use easyPHP  with:

Server version: 5.7.10

 

I comment or delete this lines. In DbPDO.php and work for me

 

Thanks

    /**
     * Selects best table engine.
     *
     * @return string
     */
    public function getBestEngine()
    {
        $value = 'InnoDB';

/*        $sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
        $result = $this->link->query($sql);
        if (!$result) {
            $value = 'MyISAM';
        }
        $row = $result->fetch();
        if (!$row || strtolower($row['Value']) != 'yes') {
            $value = 'MyISAM';
        }*/

        /* MySQL >= 5.6 */
        $sql = 'SHOW ENGINES';
        $result = $this->link->query($sql);
        while ($row = $result->fetch()) {
            if ($row['Engine'] == 'InnoDB') {
                if (in_array($row['Support'], array('DEFAULT', 'YES'))) {
                    $value = 'InnoDB';
                }
                break;
            }
        }

        return $value;
    }
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...