Link to home
Start Free TrialLog in
Avatar of rivkamak
rivkamakFlag for United States of America

asked on

Laravel PDO missing driver on site but not with migration

I am trying out laravel with MSSQL for the first time.
I installed the neccessary 'SQLSRV' drivers.

I was able to use migration to create a new table to my database.
Then when i am trying to select , I am getting a laravel error, PDO missing driver.

is there a different php.ini setting for my laravel site vs the artisan migration?
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Are you on a Windows web server?  The 'SQLSRV' drivers only work on Windows.  And yes, if you are on a Windows server, the 'sqlsrv' drivers need to be included in your 'php.ini' file and they have to exist in your 'ext' directory.
Avatar of rivkamak

ASKER

I am on a windows server.
when I first tried the migration, I got the error PDO driver missing. I downloaded the driver, and put it in my .ini file.
Then the migration worked.
Now when I try to select to the database from Laravel website itself, the website it now telling me PDO driver missing.
Is it possible that my laravel is pointing to a different .ini file and how would I figure that out?
Run 'phpinfo()' to see where PHP is finding it's 'php.ini'.  In the 'sqlsrv' drivers, they must match the version of PHP that you are running and they must be the 'nts' versions to use with IIS.
Yes my driver matched my php version.
I am trying to pinpoint why migration worked, but my site doesn't
Probably the 'migration' just moved files but doesn't check for prerequisites.  For 'sqlsrv', if your MS SQL database server is on another machine, you also need to install the SQL Native Client for that version of SQL Server.  SQL Native Client is not part of the 'sqlsrv' driver but it is required for it to operate.
my migration was able to create a table on the sql database. So it was able to connect.
and i set up the php.ini file properly with the driver ( I think).
So what else can I check?
What is your exact error message?
PDO missing driver
Look in your extensions directory for something like 'php_pdo_sqlsrv_56_nts_vc9.dll'.
This is the closest one that I have.
php_pdo_sqlsrv_56_ts.dll
That would be for Apache.  If you are on IIS, you need the 'nts' version.
My local computer is apache, I am trying to connect to a windows server sql
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial