Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to 5.8.0: 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found #1513

Closed
doits opened this issue Jun 20, 2023 · 8 comments
Closed

Migration to 5.8.0: 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found #1513

doits opened this issue Jun 20, 2023 · 8 comments

Comments

@doits
Copy link
Contributor

doits commented Jun 20, 2023

When upgrading I git this error running the migrations:

$ ./please migrate
Migrating: 2023_02_28_000000_inventory_bigint_id
PHP Fatal error:  Uncaught Error: Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found in /var/www/munkireport-php/vendor/illuminate/database/MySqlConnection.php:64
Stack trace:
#0 /var/www/munkireport-php/vendor/illuminate/database/Connection.php(894): Illuminate\Database\MySqlConnection->getDoctrineDriver()
#1 /var/www/munkireport-php/vendor/illuminate/database/Schema/Grammars/ChangeColumn.php(36): Illuminate\Database\Connection->getDoctrineSchemaManager()
#2 /var/www/munkireport-php/vendor/illuminate/database/Schema/Grammars/Grammar.php(55): Illuminate\Database\Schema\Grammars\ChangeColumn::compile()
#3 /var/www/munkireport-php/vendor/illuminate/database/Schema/Blueprint.php(128): Illuminate\Database\Schema\Grammars\Grammar->compileChange()
#4 /var/www/munkireport-php/vendor/illuminate/database/Schema/Blueprint.php(101): Illuminate\Database\Schema\Blueprint->toSql()
#5 /var/www/munkireport-php/vendor/illuminate/database/Schema/Builder.php(290): Illuminate\Database\Schema\Blueprint->build()
#6 /var/www/munkireport-php/vend in /var/www/munkireport-php/vendor/illuminate/database/MySqlConnection.php on line 64

Changing composer.json to require an older doctrine/dbal fixes it:

diff --git a/composer.json b/composer.json
index 311764a3..fa31fd10 100644
--- a/composer.json
+++ b/composer.json
@@ -77,7 +77,7 @@
     "fakerphp/faker": "^1.13",
     "guzzlehttp/guzzle": "~7.0",
     "munkireport/usb": "^3.0",
-    "doctrine/dbal": "~3.6",
+    "doctrine/dbal": "~2.3",
     "munkireport/sentinelone": "^3.0",
     "munkireport/inventory": "^7.0",
     "adldap2/adldap2": "^10",

Looks like the migration is not compatible with newer dbal?

I reverted the change after the migrations completed, but I'm not sure what should be the correct version in the end.

@bochoven
Copy link
Contributor

Is your server running php 8.x?

@doits
Copy link
Contributor Author

doits commented Jun 20, 2023

Thanks for your help. It is indeed running v7.4.3. Can this be the cause of the error?

@bochoven
Copy link
Contributor

Yes, that is probably the reason. Composer will install a newer version of DBAL when PHP is upgraded

@bochoven
Copy link
Contributor

Make sure to run composer update after you update the PHP version on the server

@doits
Copy link
Contributor Author

doits commented Jun 20, 2023

I run composer update before running the migrations, so it should be up to date.

I just checked it installs doctrine/dbal 3.6.3 (latest version) even with my php 7 version, and with this version the migration failed.

According to https://stackoverflow.com/a/65075035 the downgrade fixes the error about the missing class (which it did for me). Looks like the class does not exist in dbal 3, see doctrine/dbal#4439? For me it looks like there might be an error using Doctrine\DBAL\Driver\PDOMySql\Driver with dbal 3, but this is just a guess.

I will update to php 8 soon to be on the supported version – for now everything seems to work even with php 7 after the migration completed with the old dbal 2 version.

@doits
Copy link
Contributor Author

doits commented Jun 20, 2023

Aah probably it is because illumniate/database is incompatible with dbal 3 ... it installs v7.30.6 for me, probably the later versions are not compatible with php 7.

@doits
Copy link
Contributor Author

doits commented Jun 20, 2023

Seems to be only supported from v8.15.0 onwards, see https://github.com/laravel/framework/releases/tag/v8.15.0

Added Support DBAL v3.0 (laravel/framework#35236)

@bochoven
Copy link
Contributor

I don't think we want to keep supporting EOL versions of PHP, so I'm closing this issue. I think we need to update the docs so it's clear that PHP 7 is not supported anymore in MunkiReport 5.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants