Marco Dinatsoli
Marco Dinatsoli

Reputation: 10580

vtiger Call to a member function Execute() on null in C:\xampp\htdocs\vtigercrm\include\database\PearDatabase

I am installing vtiger,

when i open the index page,

i got this error:

Fatal error: Call to a member function Execute() on null in C:\xampp\htdocs\vtigercrm\include\database\PearDatabase.php on line 357

i opened the PearDatabase.php file, and I found this:

if($this->avoidPreparedSql || empty($params)) {
            $sql = $this->convert2Sql($sql, $params);
            $result = $this->database->Execute($sql);
        } else {
            $result = $this->database->Execute($sql, $params);
        }

the line 357 is:

$result = $this->database->Execute($sql);

Upvotes: 1

Views: 2746

Answers (3)

mbelanger
mbelanger

Reputation: 11

You will receive this error when installing vTiger if your session_save_path() is not writable by your web server user.

In my case, my 'session_save_path' was /var/lib/php/7.1/session and was owned by root. I am using Nginx so I executed the following command to resolve my issue:

sudo chown -R nginx:nginx /var/lib/php/7.1/session

If you are using Apache, you would execute the following command to resolve your issue:

sudo chown -R www-data:www-data /var/lib/php/7.1/session

The information entered into the vTiger wizard is saved to $_SESSION as you navigate through the installation steps.

When the 'session_save_path' is owned by root rather than the web server user, the session data is not saved between function Step5() and function Step6() in modules/Install/views/Index.php. So when the config.inc.php file is created by the wizard, all the configuration data you entered into the form is not written to config.inc.php since your data was not saved in $_SESSION between the requests. This can be fixed by changing the permissions on your 'session_save_path' to be writable by the web server user.

You can find your session.save_path in your php.ini file or your www.conf file if you are using php-fpm:

/etc/php-fpm-7.1.d/www.conf:php_value[session.save_path]    = /var/lib/php/7.1/session

This unhelpful error is actually because your database connection is unsuccessful in file include/database/PearDatabase.php in function connect() since all the database variables are empty.

Hope this helps.

Upvotes: 1

Jack Wang
Jack Wang

Reputation: 51

If you have installed vtiger once locally, you have to clean cookies in your brower of your local vtiger domain. That should fix your problem, what a amazing bug it is!

Upvotes: 3

Justin
Justin

Reputation: 66

Make sure you have installed all the pre-requisites:

Pre-requisites from here:

  • Apache 2.1+
  • MySQL 5.1+ (default storage engine = InnoDB)
  • PHP 5.2+, 5.3
    • php-imap
    • php-curl
    • php-xml
    • max_memory (min. 256MB)
    • max_execution_time (min. 60 seconds)
    • error_reporting (E_ALL & ~E_NOTICE & ~E_DEPRECATED)
  • Hardware: 4 GB RAM, 250 GB Disk (for file attachments)

The error is suggesting that it can't work out what to do with the back end database.

Upvotes: 1

Related Questions