themetman's picture

I have a fresh install of Gentoo Linux which I have used for nearly 20 years now. I have been using Drupal 7 and 8 for about 6 years, and have converted to Backdrop last year. I use Drush and the command line mostly.

I have this error when clicking the 'Save and Continue' button on the first page which I cannot find on the Forum at all.

Error: Call to a member function name() on boolean in install_settings_form() (line 984 of /PATH/TO/backdrop.local/core/includes/install.core.inc). 

I have created a fresh install of Backdrop, so have downloaded the zip file and extracted into backdrop.local folder, created the Virtual Host as usual and gone to html://backdrop.local in the browser. Select Language as English, and click the 'Save and Continue' button. If I use Drush (my preferred method) I have the same error.

There are no errors in the Apache Logs, and the access log shows no problems:

127.0.0.1 - - [04/Mar/2020:09:06:55 +0000] "POST /core/install.php HTTP/1.1" 302 - "http://backdrop.local/core/install.php" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
127.0.0.1 - - [04/Mar/2020:09:06:55 +0000] "GET /core/install.php?langcode=en HTTP/1.1" 302 - "http://backdrop.local/core/install.php" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
127.0.0.1 - - [04/Mar/2020:09:06:55 +0000] "GET /core/install.php?langcode=en&profile=standard HTTP/1.1" 500 3137 "http://backdrop.local/core/install.php" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"

Help would be appreciated.

Comments

The Call to a member function name() on boolean error seems to refer to this line in install_settings_form():

$form['driver']['#options']['mysql'] = $driver->name();

It's trying to call the name() function, but it's being called on a boolean rather than an object. This means that $driver should be an object, but is a boolean instead. $driver is set just above that line with:

$driver = backdrop_load_database_driver();

backdrop_load_database_driver() is therefore returning FALSE in your case which implies that there's an issue with your database. What database are you using? Note that only MySQL/MariaDB are supported in Backdrop, unlike Drupal: https://backdropcms.org/requirements

themetman's picture

@BWPanda I have just been looking at that line in the install.core.inc file

I think I have spotted the problem, I have not compiled php with mysql, only mysqli, so I am going to recompile with mysql USE Flag and I think that will cure it.

I will let you know later how I get on. I have a problem with a module compiling which I will have to fix first.

themetman's picture

BINGO!!!! Anyway I fixed my own problem.

Sorry to bother you all.

The below method demonstrates how to enable Backdrop in an Operating Environment that features a PHP installation that selectively loads modules.

This error can also occur when you attempt to use Backdrop without the PHP PDO (PHP Data Objects) module loaded.  I, for instance, received this error while only having the mysqli.so module active in my PHP environment when installing backdrop on an HP Thin Client running Tiny Core Linux.

On Tiny Core Linux, PHP PDO is not enabled by default, mysqli is.

How To Enable PHP PDO

To enable PHP PDO, you must have the following two PHP modules present on your system (location varies by distribution):

mysqlnd.so
pdo_mysql.so

How To Determine If You Have PHP PDO Available

The easiest way to determine if you have PHP PDO Available is to ask PHP if those modules are loaded:

$ php -m | grep mysql
mysqlnd
pdo_mysql

Another way of finding them is to go to the root of your system and search for them using the find command:

# cd /

# find . -name "pdo_mysql.so"

If they are not present, you may need to install an Operating Environment extension.

  • The name of the PHP PDO extension often varies by your PHP version
  • Installing the extension usually requires a package manager whose name and methodology varies by distribution

Here's three examples:

# yum install php-mysql

# apt-get install php7-mysql

# tce-load -wi php-8.0-ext.tcz

Once installed, those two modules need to be activated in php.ini:

extension=mysqlnd
extension=pdo_mysql

Finally, the web server needs to be restarted to prompt it to re-scan the php.ini file and load the implicated modules.  The exact way of doing this varies by distribution and web server type (apache, apache2, nginx, lighthttpd).

Once the web server has restarted, there are two ways to determine if the modules have been loaded:

  • Create a phpinfo.php file and browse to it using a web browser
  • Use the php -m command as detailed above