Accessing the system issue with PHP 8.0 and PHP 8.1

Hi Guys

There seems to be an issue with logging in. Everytime I connect via web browser, I get Error 500 and have to first switch PHP 8.1 back to PHP 8.0 to see the login screen with the username/password etc. Then after I enter the credentials, I have to quickly switch back to PHP 8.1 as it won’t physically access on PHP 8.0.

Is there a work around this issue to just work properly on PHP8.1 without having to change it manually all the time?

This is my laravel log shows from yesterday:

[2022-09-10 10:46:34] production.ERROR: During inheritance of PDO: Uncaught ErrorException: Return type of Doctrine\DBAL\Driver\PDOConnection::exec($sql) should either be compatible with PDO::exec(string $statement): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/www/users/(commented out)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:50

Stack trace:

#0 /usr/www/users/(commented out)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(22): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, ‘Return type of …’, ‘/usr/www/users/…’, 50)

#1 /usr/www/users/(commented out)/vendor/composer/ClassLoader.php(480): include(‘/usr/www/users/…’)

#2 /usr/www/users/(commented out)/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile(‘/usr/www/users/…’)

#3 [internal function]: Composer\Autoload\ClassLoader->loadClass(‘Doctrine\DBAL\D…’)

#4 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(66): class_exists(‘Doctrine\DBAL\D…’)

#5 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection(‘mysql:host=dedi…’, (commented out), ‘(commented out)…’, Array)

#6 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection(‘mysql:host=dedi…’, Array, Array)

#7 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect(Array)

#8 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}()

#9 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(997): call_user_func(Object(Closure))

#10 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1033): Illuminate\Database\Connection->getPdo()

#11 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(426): Illuminate\Database\Connection->getReadPdo()

#12 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(352): Illuminate\Database\Connection->getPdoForSelect(true)

#13 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(685): Illuminate\Database\Connection->Illuminate\Database{closure}(‘select * from i…’, Array)

#14 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(652): Illuminate\Database\Connection->runQueryCallback(‘select * from i…’, Array, Object(Closure))

#15 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(360): Illuminate\Database\Connection->run(‘select * from i…’, Array, Object(Closure))

#16 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(44): Illuminate\Database\Connection->select(‘select * from i…’, Array)

#17 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Database\Schema\MySqlBuilder->hasTable(‘accounts’)

#18 /usr/www/users/(commented out)/app/Exceptions/Handler.php(78): Illuminate\Support\Facades\Facade::__callStatic(‘hasTable’, Array)

#19 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(414): App\Exceptions\Handler->report(Object(ErrorException))

#20 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\Foundation\Http\Kernel->reportException(Object(ErrorException))

#21 /usr/www/users/(commented out)/public/index.php(57): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

#22 {main} {“exception”:"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): During inheritance of PDO: Uncaught ErrorException: Return type of Doctrine\DBAL\Driver\PDOConnection::exec($sql) should either be compatible with PDO::exec(string $statement): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/www/users/(commented out)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:50

Stack trace:

#0 /usr/www/users/(commented out)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(22): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, ‘Return type of …’, ‘/usr/www/users/…’, 50)

#1 /usr/www/users/(commented out)/vendor/composer/ClassLoader.php(480): include(‘/usr/www/users/…’)

#2 /usr/www/users/(commented out)/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile(‘/usr/www/users/…’)

#3 [internal function]: Composer\Autoload\ClassLoader->loadClass(‘Doctrine\\DBAL\\D…’)

#4 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(66): class_exists(‘Doctrine\\DBAL\\D…’)

#5 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection(‘mysql:host=dedi…’, (commented out), ‘(commented out)…’, Array)

#6 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection(‘mysql:host=dedi…’, Array, Array)

#7 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect(Array)

#8 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()

#9 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(997): call_user_func(Object(Closure))

#10 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1033): Illuminate\Database\Connection->getPdo()

#11 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(426): Illuminate\Database\Connection->getReadPdo()

#12 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(352): Illuminate\Database\Connection->getPdoForSelect(true)

#13 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(685): Illuminate\Database\Connection->Illuminate\Database\{closure}(‘select * from i…’, Array)

#14 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(652): Illuminate\Database\Connection->runQueryCallback(‘select * from i…’, Array, Object(Closure))

#15 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Connection.php(360): Illuminate\Database\Connection->run(‘select * from i…’, Array, Object(Closure))

#16 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(44): Illuminate\Database\Connection->select(‘select * from i…’, Array)

#17 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Database\Schema\MySqlBuilder->hasTable(‘accounts’)

#18 /usr/www/users/(commented out)/app/Exceptions/Handler.php(78): Illuminate\Support\Facades\Facade::__callStatic(‘hasTable’, Array)

#19 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(414): App\Exceptions\Handler->report(Object(ErrorException))

#20 /usr/www/users/(commented out)/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\Foundation\Http\Kernel->reportException(Object(ErrorException))

#21 /usr/www/users/(commented out)/public/index.php(57): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

#22 {main} at /usr/www/users/(commented out)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:22)

[stacktrace]

#0 {main}

"}

What I am running:
Invoice Ninja v5.5.20-C67

Hi,

Can you please confirm the php8.1-mysql extension is installed?

Thanks for reply Hillel.

Host confirms it is.

also got this:

PHP Version 8.1.9

System Linux (commented out) 4.19.0-21-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
Build Date Aug 15 2022 09:50:29
Build System Linux
Server API FPM/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php/8.1/fpm
Loaded Configuration File /etc/php/8.1/fpm/php.ini
Scan this dir for additional .ini files /etc/php/8.1/fpm/conf.d
Additional .ini files parsed /etc/php/8.1/fpm/conf.d/10-mysqlnd.ini, /etc/php/8.1/fpm/conf.d/10-opcache.ini, /etc/php/8.1/fpm/conf.d/10-pdo.ini, /etc/php/8.1/fpm/conf.d/15-xml.ini, /etc/php/8.1/fpm/conf.d/20-bcmath.ini, /etc/php/8.1/fpm/conf.d/20-bz2.ini, /etc/php/8.1/fpm/conf.d/20-calendar.ini, /etc/php/8.1/fpm/conf.d/20-ctype.ini, /etc/php/8.1/fpm/conf.d/20-curl.ini, /etc/php/8.1/fpm/conf.d/20-dba.ini, /etc/php/8.1/fpm/conf.d/20-dom.ini, /etc/php/8.1/fpm/conf.d/20-exif.ini, /etc/php/8.1/fpm/conf.d/20-ffi.ini, /etc/php/8.1/fpm/conf.d/20-fileinfo.ini, /etc/php/8.1/fpm/conf.d/20-ftp.ini, /etc/php/8.1/fpm/conf.d/20-gd.ini, /etc/php/8.1/fpm/conf.d/20-gettext.ini, /etc/php/8.1/fpm/conf.d/20-gmp.ini, /etc/php/8.1/fpm/conf.d/20-iconv.ini, /etc/php/8.1/fpm/conf.d/20-igbinary.ini, /etc/php/8.1/fpm/conf.d/20-imagick.ini, /etc/php/8.1/fpm/conf.d/20-imap.ini, /etc/php/8.1/fpm/conf.d/20-intl.ini, /etc/php/8.1/fpm/conf.d/20-ldap.ini, /etc/php/8.1/fpm/conf.d/20-mbstring.ini, /etc/php/8.1/fpm/conf.d/20-msgpack.ini, /etc/php/8.1/fpm/conf.d/20-mysqli.ini, /etc/php/8.1/fpm/conf.d/20-odbc.ini, /etc/php/8.1/fpm/conf.d/20-pdo_dblib.ini, /etc/php/8.1/fpm/conf.d/20-pdo_mysql.ini, /etc/php/8.1/fpm/conf.d/20-pdo_odbc.ini, /etc/php/8.1/fpm/conf.d/20-pdo_pgsql.ini, /etc/php/8.1/fpm/conf.d/20-pdo_sqlite.ini, /etc/php/8.1/fpm/conf.d/20-pgsql.ini, /etc/php/8.1/fpm/conf.d/20-phar.ini, /etc/php/8.1/fpm/conf.d/20-posix.ini, /etc/php/8.1/fpm/conf.d/20-readline.ini, /etc/php/8.1/fpm/conf.d/20-shmop.ini, /etc/php/8.1/fpm/conf.d/20-simplexml.ini, /etc/php/8.1/fpm/conf.d/20-soap.ini, /etc/php/8.1/fpm/conf.d/20-sockets.ini, /etc/php/8.1/fpm/conf.d/20-sqlite3.ini, /etc/php/8.1/fpm/conf.d/20-ssh2.ini, /etc/php/8.1/fpm/conf.d/20-sysvmsg.ini, /etc/php/8.1/fpm/conf.d/20-sysvsem.ini, /etc/php/8.1/fpm/conf.d/20-sysvshm.ini, /etc/php/8.1/fpm/conf.d/20-tidy.ini, /etc/php/8.1/fpm/conf.d/20-tokenizer.ini, /etc/php/8.1/fpm/conf.d/20-xmlreader.ini, /etc/php/8.1/fpm/conf.d/20-xmlrpc.ini, /etc/php/8.1/fpm/conf.d/20-xmlwriter.ini, /etc/php/8.1/fpm/conf.d/20-xsl.ini, /etc/php/8.1/fpm/conf.d/20-zip.ini, /etc/php/8.1/fpm/conf.d/25-mailparse.ini
PHP API 20210902
PHP Extension 20210902
Zend Extension 420210902
Zend Extension Build API420210902,NTS
PHP Extension Build API20210902,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support available, disabled
Registered PHP Streams https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters zlib., string.rot13, string.toupper, string.tolower, convert., consumed, dechunk, bzip2., convert.iconv.

@david any thoughts?

I would first start off by creating a file called

phpinfo.php

and inside write

<?php
phpinfo();

save the file and put it in the public directory, and then try to access it directly

http://url.com/phpinfo.php

You’ll want to ensure that this is returning PHP8.1 as the correct version.

HI @david - it indeed returns PHP8.1 extension.

@eddie

I am at a loss on this one. The latest version of Invoice Ninja requires PHP8.1 and shouldfail when attempting to use anything else, so it is quite bizarre that switching to 8.0 works…

Thanks for the reply @david

Just to re-iterate…

I get error 500 when I open the URL of Invoice Ninja. Then once the fields become visible on the URL (to note, I have to have the setting on PHP8.0), I then complete the information (username/password) and then click on the log in button. I then get a message to state that I have to have PHP8.1 … At this point, I have to then change back my PHP to PHP8.1 and refresh my screen which then lets me into the system correctly. This is the procedure for every time I want to log into the URL to use the system to make invoices etc. I am seeking a method that I once had where I can leave it on one setting (i.e. PHP8.1) and then just enter my credentials to access the system.