Hi guys,
i'm having a strange problem. I have 2 databases, the main one is MySQL, the other Microsoft SQL. Now what i am trying to do is to execute some really simple queries, like
$perstamms = DB::connection('sqlsrv')->select('SELECT * FROM PERSPROT WHERE PSNR = 725');
dd($perstamms);
This only works if it's executed within a console command, but nowhere else like in a controller. Any idea why it behaves like that?
Greetings Marcel
Ups, sorry for not posting that information. When running this in a controller an error is thrown: "PDOException in Connector.php line 50: could not find driver"
Can you make a test.php file which contains <?php echo phpinfo(); ?>
and check that pdo_sqlsrv exists in your environment?
Sorry for not responding for some time, i figured it out just a few minutes ago. On the commandline, php -i says that sqlsrv is enabled, but not with <?php echo phpinfo(); ?> this doedn't says anything about sqlsrv. In php_error_log it prints "Unable to load dynamic library D:\xampp\php\ext\php_pdo_sqlsrv.dll", but the file exists with the same permissions as the other extensions.
Really strange, so i checked the dependencies of the dll file, and i found that there is a missing dll called "msvcp110.dll" ... long story short, i installed "Visual C++ Redistributable for Visual Studio 2012" and it worked!
I really hate windows for not managing dependencies like every linux system does. (Edit: "Visual C++ Redistributable" wasn't on the requirements list of sqlsrv)
Thanks you very much for your goodwill to help me^^
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community