guys, i already install this driver before, and worked very well, but this time, i upgraded my windows to 10, then i reinstalled my Vagrant and virtualbox again, now... when i try install the drivers at step 3.
pecl install sqlsrv
i got the error:
PHP Warning: 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 Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/sqlsrv.so' - /usr/lib/php/20160303/sqlsrv.so: cannot open shared object file: No such file or directory in Unknown on line 0
ubuntu 16.04
my output of odbcinst -j:
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/vagrant/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
output ofodbcinst -q -d -n "ODBC Driver 13 for SQL Server" :
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.1
UsageCount=1
my output of php -m :
[PHP Modules]
bcmath
blackfire
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imap
intl
json
libxml
mbstring
mcrypt
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
blackfire
Note: when i type php -v i got the same error above of the version.
my php version:
PHP 7.1.12-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Dec 14 2017 15:37:13) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.12-3+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
with blackfire v1.18.0~linux-x64-non_zts71, https://blackfire.io, by SensioLabs
Got a few questions for you @leandroruel ,
(1) Is this a clean VM or you simply restored from a saved image?
(2) If not clean, when was the last time you installed the drivers? Perhaps you can try pecl uninstall sqlsrv etc.
(3) Check if the binaries sqlsrv.so and pdo_sqlsrv.so are actually in /usr/lib/php/20160303/
(4) Did you use PHP 7.0 before or do you always use PHP 7.1?
it's a clean install and i allways use 7.1. My VM is the Laravel Homestead
So did you check if the binaries sqlsrv.so and pdo_sqlsrv.so are actually in /usr/lib/php/20160303/?
Please also check this:
php --ini | grep 'Loaded Configuration'
You should see something like
Loaded Configuration File: /etc/php/7.1/cli/php.ini
Then do this cat /etc/php/7.1/cli/php.ini | grep 'sqlsrv'
Do you see anything like extension="sqlsrv.so"?
i give up of using it with vagrant and i'm using it in a docker container where it works very well... now i'm facing other issues but is not related with this driver anymore since i tested it with sqlcmd and is working normally, thank you!
Great to hear that. Let us know if you have other problems related to our drivers. Thanks!
good I'm trying to connect to sql server from ubuntu 16.04 with php 7.0 is the first time I do could tell me what settings should I do and a connection example in php
my connection to the Windows server where installing the sql server works fine if I use an apache2 server installed on another Windows machine. But it does not work from linux (Debian)
try {
$serverName = "172.3x0.x1.x0,1433";
$database='PRUEBAS';
$user='sa';
$pass='xxxxxxxxxxx';
$conn = new PDO( "sqlsrv:Server=$serverName;Database=$database", $user, $pass);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}
catch( PDOException $e ) {
die( print_r( $e->getMessage() ) );
}echo "Connected to SQL Server\n";
$query = 'SELECT * FROM productos';
$stmt = $conn->query( $query );
while ( $row = $stmt->fetch( PDO::FETCH_ASSOC ) ){
print_r( $row );
}
?>
hi @mauricio0015, this issue is already closed and it sounds like your symptoms are completely different anyway. Could you please open a new issue with details of your problem? Please include the version of PHP and the driver version you are using. Also, to verify your setup is correct, please verify your connection using just isql, i.e. without the driver driver. Thanks.
So did you check if the binaries sqlsrv.so and pdo_sqlsrv.so are actually in
/usr/lib/php/20160303/?
Please also check this:
php --ini | grep 'Loaded Configuration'You should see something like
Loaded Configuration File: /etc/php/7.1/cli/php.iniThen do this
cat /etc/php/7.1/cli/php.ini | grep 'sqlsrv'Do you see anything like
extension="sqlsrv.so"?
Hi,
I faced a similar issue. I followed your steps as mentioned. I am using PHP 7.3 / Please suggest what next step is.
hi @prabhatkumarjena16
We need more info than that to help. For example, are you also using ubuntu? 16.04 or 18.04, etc.?
That being said, please follow our instructions on Microsoft Docs.
If not working, please create a new issue.
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20190902/sqlsrv.so (/usr/lib/php/20190902/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/sqlsrv.so.so (/usr/lib/php/20190902/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20190902/pdo_sqlsrv.so (/usr/lib/php/20190902/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_sqlsrv.so.so (/usr/lib/php/20190902/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.3 (cli) (built: Feb 23 2020 07:24:02) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
i faced issue to get php version and not able to install sqlsrv driver on ubuntu 16.04
hi @mkmanoj95 , just as I said above, in order to help we need more info than what you provided. Please create a new issue.
try pecl install sqlsrv pdo_sqlsrv again
Most helpful comment
Great to hear that. Let us know if you have other problems related to our drivers. Thanks!