I have a project ( laravel5.3, php7, centos7
) pulling some data from MSSQL
(not my choice btw). So, on XAMPP I was able to get it running successfully with ease using pdo_sqlsrv
, however thats only for windows.
So how do I get it running on CentOS?
Thanks.
Solved it myself after a lot of research.
{1}
Ive followed this guide to get sqlsrv
and pdo_sqlsrv
(step 2, Terminal):
https://www.microsoft.com/en-us/sql-server/developer-get-started/php-rhel
sqlsrv
was fine and could be seen in phpinfo, however pdo_sqlsrv
couldnt be found.
Further, if you run $ php -v
you get the error
Unable to load dynamic library '******/pdo_sqlsrv.so': undefined symbol: php_pdo_register_driver in Unknown on line 0"
{2}
This let to major chase on how to fix it. Turns out the pdo.so
was loading after pdo_sqlsrv.so
as pdo.so loads from /etc/php.d/
dir and I placed pdo_sqlsrv.so in the php.ini (as recom by the microsoft link). This I found by reading here https://github.com/Microsoft/msphpsql/issues/151
So I moved the following lines to /etc/php.d/pdo.ini
:
extension=/usr/lib64/php/modules/sqlsrv.so
extension=/usr/lib64/php/modules/pdo_sqlsrv.so
Problem solved
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.