Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Scarf84's avatar

Error could not find driver

I have a problem. I can't run the command "php artisan optimize:clear." It gives me the error "could not find driver (Connection: sqlsrv, SQL: delete from [cache])"

The rest of the command works correctly, only this one. How can I fix it?

0 likes
11 replies
Scarf84's avatar

Hi Glukinho, thanks for the reply. The problem is that if I log in or extract the user list, it does so without any problems. If there's a problem with the MS SQL driver extension, nothing should work, right?

Glukinho's avatar

Show .env, config/cache.php, config/database.php files.

Scarf84's avatar

Here are the files

File .env

File database.php

File cache.php

Glukinho's avatar

If you go to php artisan tinker and put some value in cache, will it appear in cache table of your MS SQL database?

# php artisan tinker

> Cache::put('testkey', 'testvalue')

Do you see something like "testkey" in cache table after that?

Scarf84's avatar

My application runs on Debian and I run the command via ssh command line.

dev@itl-s-hosting:~/htdocs/*******$ php artisan optimize:clear
martinbean's avatar

@scarf84 Then it sounds like the CLI version of PHP is not using the same php.ini file as your web server, so has different modules installed (and not installed).

Run php --ini when logged in via SSH, and it will show you the php.ini file(s) it has loaded and is using when running PHP commands via the command line. Then compare it to the ones your web server is loading.

1 like
Scarf84's avatar

You're right, the ssh instance runs PHP 8.4 and my application runs PHP 8.2. Thanks a lot, solved.

1 like
martinbean's avatar

@scarf84 Glad you got to the bottom of it. Feel free to mark the thread as solved if that’s the case.

Please or to participate in this conversation.