Homestead: Unable to load dynamic library pdo_sqlsrv.so

Created on 14 Nov 2017  路  8Comments  路  Source: laravel/homestead

Versions

  • Vagrant: 2.0.1
  • Provider: Virtualbox, version 5.1.30 r118389
  • Homestead: 6.5.0

Host operating system

Mac Os 10.12.6 (16G29)

Homestead.yaml

ip: 192.168.10.10
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    -
        map: /Users/nicolaswidart/Sites/Freelance/Themosis/projectname
        to: /home/vagrant/code
sites:
    -
        map: projectname.dev
        to: /home/vagrant/code/htdocs
databases:
    - projectname
name: projectname
hostname: projectname
mariadb: true

Vagrant up output

https://gist.github.com/nWidart/bafba3801a948021388fb7d897a3e090

Expected behavior

No errors related to the pdo_sqlsrv.so extension

Actual behavior

PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/pdo_sqlsrv.so' - /usr/lib/php/20160303/pdo_sqlsrv.so: cannot open shared object file: No such file or directory in file Unknown on line 0

It's doing this mostly on some ajax calls. Yes, not all, and not on page load itself.
It's also doing this on the initial page load after a fresh vagrant up, but after a refresh or 2, it disappears.

Thanks,

All 8 comments

This is a known issue. Thanks for reporting. Will have to dig into why this is working some times and not consistently.

I've spent all day trying to get a solution for this an am currently unable to get a working resolution. I'm declaring MSSQL drivers unsupported until the documentation is updated to provide a working solution or until someone is able to PR a working solution. Sorry for the issues.

https://github.com/laravel/settler/pull/125

Hm ok thank you for the heads up. It's strange because it's not even using mssql, but mariad db.

just to let you know, this same error and calming after several tries shows up on vagrant box 4.0.0 (not 3) , vagrant 1.9.6, homestead 2.2.0 also.

@narration-sd Yep. I'm waiting for PHP 7.2 to be released before pushing out a new base box update.

@svpernova09 ok and thanks much for letting us know.

It was a little confusing whether the issue was disappeared, since it's been closed.

Here is a fix for this issue that worked for me:

  1. SSH into your vagrant box

  2. Open the PHP ini file in an editor (as sudo)
    sudo nano /etc/php/7.1/fpm/php.ini

  3. Search for sqlsrv.so if you are using nano it is Ctrl + W and then enter sqlsrv.so and press enter

  4. Put a semicolon in front of the following lines so it looks like this:
    [mssql]
    ;extension=sqlsrv.so
    ;extension=pdo_sqlsrv.so

  5. Save and exit. Ctrl + O and then Ctrl + X

  6. Restart your vagrant box

I hope that helps. Happy PHPing!

FWIW, getting the latest round of MSSQL PDO driver working is a royal PITA, but I got it working in docker with the following crap:
https://gist.github.com/thorerik/18cf66619dcbc67343c38056c20585aa#file-dockerfile-L16-L21
https://gist.github.com/thorerik/18cf66619dcbc67343c38056c20585aa#file-dockerfile-L43-L49

So if you need mssql support, that's what I had to do to get it running.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

it-can picture it-can  路  3Comments

m4olivei picture m4olivei  路  4Comments

svpernova09 picture svpernova09  路  3Comments

daryn-k picture daryn-k  路  5Comments

mtpultz picture mtpultz  路  4Comments