Schema.php:45 Error

Dear all,

It’s fail after restart, any idea?

2021/06/25 23:38:15 [error] 10327#10327: *2 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php:45
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\Support\Facades\Schema::getFacadeAccessor()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#2 /usr/share/nginx/invoiceninja/app/Exceptions/Handler.php(75): Illuminate\Support\Facades\Facade::__callStatic(‘hasTable’, Array)
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(414): App\Exceptions\Handler->report(Object(Error))
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\Foundation\Http\Kernel->reportException(Object(Error))
#5 /usr/share/nginx/invoicen” while reading response header from upstream, client: 10.0.99.6, server: portal1.ijdevelop.com, request: “GET / HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php/php-fpm.sock:”, host: “portal1.ijdevelop.com

Hi,

Uncaught Error: Call to a member function connection() on null

Indicates a database issue. either an extension missing or something to do with the system not being able to connect to the database.

you may get more information from the system by trying to boot up tinker

php artisan tinker

This may give more clues.

php artisan tinker

PHP Notice: Trying to access array offset on value of type null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php on line 45
PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php:45
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\Support\Facades\Schema::getFacadeAccessor()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#2 /usr/share/nginx/invoiceninja/app/Exceptions/Handler.php(75): Illuminate\Support\Facades\Facade::__callStatic(‘hasTable’, Array)
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(366): App\Exceptions\Handler->report(Object(Error))
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(Error))
#5 /usr/share/nginx/invoiceninja/artisan(37): Illuminate\Found in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php on line 45

Same error return.

Any idea?

Are the database credentials in the .env file correct?

Yes, I try to use the same params for the login.

.env
DB_HOST1=localhost
DB_DATABASE1=ninjadb
DB_USERNAME1=ninja
DB_PASSWORD1=P@ssw0rd
DB_PORT1=3306

command test.

mysql -uninja -pP@ssw0rd -hlocalhost ninjadb

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 26
Server version: 10.4.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [ninjadb]>

@david do you have any suggestions?

@Isaac I would delete the contents of bootstrap/cache and try again.

rm -f /usr/share/nginx/invoiceninja/bootstrap/cache/.

ls -l /usr/share/nginx/invoiceninja/bootstrap/cache/

total 0

cd /usr/share/nginx/invoiceninja/

php artisan tinker

PHP Notice: Trying to access array offset on value of type null in /usr/share/n ginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema .php on line 45
PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Suppor t/Facades/Schema.php:45
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support /Facades/Facade.php(166): Illuminate\Support\Facades\Schema::getFacadeAccessor()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support /Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#2 /usr/share/nginx/invoiceninja/app/Exceptions/Handler.php(75): Illuminate\Supp ort\Facades\Facade::__callStatic(‘hasTable’, Array)
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundat ion/Console/Kernel.php(366): App\Exceptions\Handler->report(Object(Error))
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundat ion/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportExcepti on(Object(Error))
#5 /usr/share/nginx/invoiceninja/artisan(37): Illuminate\Found in /usr/share/ngi nx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.p hp on line 45

after deleted. same result. any missing step?

@david @hillel
any idea?

@Isaac

The other options I can suggest are

composer install --no-dev -o
php artisan clear-compiled
php artisan optimize

@david

Thank you very much, but seems fail and same result. Anyway, please leave it and let me reinstall everything. Thank million.

Isaac