1

OS Ubuntu 16.04 PHP 7.0

All drivers install used this manual ( https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac )

updated php.ini

enter image description here

But still, have this error.

Any Ideas?

Thank you

Konstantin

jarlh
  • 42,561
  • 8
  • 45
  • 63
Konstantin111
  • 219
  • 1
  • 3
  • 12
  • 1
    Do you get that error through the web server or when you run a script through cli? – M. Eriksson Nov 16 '17 at 14:17
  • This error from Visual Studio Code debugger. From web server. Error information: SQLSTATE: HYT00 Code: 0 Message: [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired SQLSTATE: 08001 Code: 87 Message: [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]MAX_PROVS: Connection string is not valid [87]. SQLSTATE: 08001 But all connection information correct. I can connect to this database using SSMS with out any problem. – Konstantin111 Nov 16 '17 at 14:24
  • 1
    What does that error have to do with your question?? Getting a connection error is not the same as "Undefined function". – M. Eriksson Nov 16 '17 at 14:32
  • When I run code from VSC I have this error Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in.... When I run the same code from WEB error Connection string is not valid. The same code generates two different type of error. So to whom believe? – Konstantin111 Nov 16 '17 at 14:57
  • 1
    My guess would be that VSC runs PHP through command line (to check for errors etc.) so you need to enable the extension for cli as well. It's the same way as for Apache2, but that ini file is usually located in: `/etc/php/7.0/cli/php.ini`. – M. Eriksson Nov 16 '17 at 15:07
  • it's already enabled extension=/usr/lib/php/20151012/sqlsrv.so – Konstantin111 Nov 16 '17 at 15:15
  • Thank you, Magnus Eriksson. I don't have any idea why, but after restart Ubuntu, connection to the SQL server from the web is established. But VSC still generate the same error Undefined function sqlsrv_connect(). Konstantin. – Konstantin111 Nov 16 '17 at 15:28
  • Possible duplicate of [where can I find the php.ini for php-cli](https://stackoverflow.com/q/3057110/1255289) – miken32 Nov 16 '17 at 22:06

0 Answers0